goja-core/src/main/java/goja/core/kits/lang/Strs.java
public static String applyRelativePath(String path, String relativePath) {
        int separatorIndex = path.lastIndexOf(StringPool.SLASH);
        if (separatorIndex != -1) {
            String newPath = path.substring(0, separatorIndex);
            if (!relativePath.startsWith(StringPool.SLASH)) {
                newPath += StringPool.SLASH;
            }
            return newPath + relativePath;
        } else {
            return relativePath;
        }
    }
public static String applyRelativePath(String path, String relativePath) {
        int separatorIndex = path.lastIndexOf(StringPool.SLASH);
        if (separatorIndex != -1) {
            String newPath = path.substring(0, separatorIndex);
            if (!relativePath.startsWith(StringPool.SLASH)) {
                newPath += StringPool.SLASH;
            }
            return newPath + relativePath;
        } else {
            return relativePath;
        }
    }
Apply the given relative path to the given path,
assuming standard Java folder separation (i.e. "/" separators).

@param path         the path to start from (usually a full file path)
@param relativePath the relative path to apply
(relative to the full file path above)
@return the full file path that results from applying the relative path