private static String canonicalNormalized(CharSequence realPath) { final String path = realPath.toString(); try { return JRubyFile.normalizeSeps(new File(path).getCanonicalPath()); } catch (IOException ioe) { return path; } }
private static String canonicalNormalized(CharSequence realPath) { final String path = realPath.toString(); try { return JRubyFile.normalizeSeps(new File(path).getCanonicalPath()); } catch (IOException ioe) { return path; } }
@Override public String getAbsolutePath() { final String path = super.getPath(); if (path.startsWith("uri:")) { // TODO better do not collapse // to / for uri: files return normalizeSeps(path.replaceFirst(":/([^/])", "://$1" )); } return normalizeSeps(new File(path).getAbsolutePath()); }
@Override public String[] list(FilenameFilter filter) { String[] files = super.list(filter); if (files == null) { return null; } String[] smartFiles = new String[files.length]; for (int i = 0; i < files.length; i++) { smartFiles[i] = normalizeSeps(files[i]); } return smartFiles; }
@Override public String getParent() { String parent = super.getParent(); if (parent != null) { parent = normalizeSeps(parent); } return parent; }
@Override public String[] list(FilenameFilter filter) { String[] files = super.list(filter); if (files == null) { return null; } String[] smartFiles = new String[files.length]; for (int i = 0; i < files.length; i++) { smartFiles[i] = normalizeSeps(files[i]); } return smartFiles; }
public static String getFilenameFromPathAndName(File resourcePath, String resourceName, boolean isAbsolute) { // Note: We use RubyFile's canonicalize rather than Java's for relative paths because Java's will follow // symlinks and result in __FILE__ being set to the target of the symlink rather than the filename provided. return normalizeSeps(resourcePath != null && !isAbsolute ? canonicalize(resourcePath.getPath()) : resourceName); } }
public static String getFileProperty(String property) { return normalizeSeps(SafePropertyAccessor.getProperty(property, "/")); }
@Override public String getParent() { String par = super.getParent(); if (par != null) { par = normalizeSeps(par); } return par; }
@Override public String getParent() { String par = super.getParent(); if (par != null) { par = normalizeSeps(par); } return par; }
@Override public String[] list(FilenameFilter filter) { String[] files = super.list(filter); if (files == null) { return null; } String[] smartFiles = new String[files.length]; for (int i = 0; i < files.length; i++) { smartFiles[i] = normalizeSeps(files[i]); } return smartFiles; }
@Override public String[] list(FilenameFilter filter) { String[] files = super.list(filter); if (files == null) { return null; } String[] smartFiles = new String[files.length]; for (int i = 0; i < files.length; i++) { smartFiles[i] = normalizeSeps(files[i]); } return smartFiles; }
@Override public String toString() { return normalizeSeps(super.toString()); }
public static String getFileProperty(String property) { return normalizeSeps(SafePropertyAccessor.getProperty(property, "/")); }
@Override public String toString() { return normalizeSeps(super.toString()); }
public static String getFilenameFromPathAndName(File resourcePath, String resourceName, boolean isAbsolute) { // Note: We use RubyFile's canonicalize rather than Java's for relative paths because Java's will follow // symlinks and result in __FILE__ being set to the target of the symlink rather than the filename provided. return normalizeSeps(resourcePath != null && !isAbsolute ? canonicalize(resourcePath.getPath()) : resourceName); } }
@Override public String getParent() { String parent = super.getParent(); if (parent != null) { parent = normalizeSeps(parent); } return parent; }
@Override public String getCanonicalPath() throws IOException { try { return normalizeSeps(super.getCanonicalPath()); } catch (IOException e) { // usually IOExceptions don't tell us anything about the path, // so add an extra wrapper to give more debugging help. throw (IOException) new IOException("Unable to canonicalize path: " + getAbsolutePath()).initCause(e); } }
@Override public String getCanonicalPath() throws IOException { try { return normalizeSeps(super.getCanonicalPath()); } catch (IOException e) { // usually IOExceptions don't tell us anything about the path, // so add an extra wrapper to give more debugging help. throw new IOException("Unable to canonicalize path: " + getAbsolutePath(), e); } }
@Override public String getCanonicalPath() throws IOException { try { return normalizeSeps(super.getCanonicalPath()); } catch (IOException e) { // usually IOExceptions don't tell us anything about the path, // so add an extra wrapper to give more debugging help. throw new IOException("Unable to canonicalize path: " + getAbsolutePath(), e); } }