private static String calculateRelativePath(String uri, String base, boolean fileUrl) { // if this is a file URL (very likely), and if this is on a case-insensitive file system, // then treat it accordingly. boolean onWindows = File.pathSeparatorChar==';'; if (base == null) { return null; } if ((fileUrl && onWindows && startsWithIgnoreCase(uri,base)) || uri.startsWith(base)) { return uri.substring(base.length()); } else { return "../" + calculateRelativePath(uri, getParentUriPath(base), fileUrl); } }
return "."; String relPath = calculateRelativePath(uriPath, basePath, fixNull(theUri.getScheme()).equals("file"));
private static String calculateRelativePath(String uri, String base, boolean fileUrl) { // if this is a file URL (very likely), and if this is on a case-insensitive file system, // then treat it accordingly. boolean onWindows = File.pathSeparatorChar==';'; if (base == null) { return null; } if ((fileUrl && onWindows && startsWithIgnoreCase(uri,base)) || uri.startsWith(base)) { return uri.substring(base.length()); } else { return "../" + calculateRelativePath(uri, getParentUriPath(base), fileUrl); } }
return "."; String relPath = calculateRelativePath(uriPath, basePath, fixNull(theUri.getScheme()).equals("file"));
private static String calculateRelativePath(String uri, String base, boolean fileUrl) { // if this is a file URL (very likely), and if this is on a case-insensitive file system, // then treat it accordingly. boolean onWindows = File.pathSeparatorChar==';'; if (base == null) { return null; } if ((fileUrl && onWindows && startsWithIgnoreCase(uri,base)) || uri.startsWith(base)) { return uri.substring(base.length()); } else { return "../" + calculateRelativePath(uri, getParentUriPath(base), fileUrl); } }
private static String calculateRelativePath(String uri, String base, boolean fileUrl) { // if this is a file URL (very likely), and if this is on a case-insensitive file system, // then treat it accordingly. boolean onWindows = File.pathSeparatorChar==';'; if (base == null) { return null; } if ((fileUrl && onWindows && startsWithIgnoreCase(uri,base)) || uri.startsWith(base)) { return uri.substring(base.length()); } else { return "../" + calculateRelativePath(uri, getParentUriPath(base), fileUrl); } }
return "."; String relPath = calculateRelativePath(uriPath, basePath, fixNull(theUri.getScheme()).equals("file"));
return "."; String relPath = calculateRelativePath(uriPath, basePath, fixNull(theUri.getScheme()).equals("file"));