List of utility methods to do Is Symbolic Link
boolean | isSymlink(File file) Checks if the given file represents a symlink. String name = file.getName(); if (name.equals(".") || name.equals("..")) { return false; File fileInCanonicalParent; File parentDir = file.getParentFile(); if (parentDir == null) { fileInCanonicalParent = file; ... |
boolean | isSymlink(File file) is Symlink Objects.requireNonNull(file, "File must not be null"); if (File.separatorChar == '\\') return false; File fileInCanonicalDir; if (file.getParent() == null) fileInCanonicalDir = file; else { File canonicalDir = file.getParentFile().getCanonicalFile(); ... |
boolean | isSymlink(File file) is Symlink if (file == null) throw new NullPointerException("File must not be null"); File canon; if (file.getParent() == null) { canon = file; } else { File canonDir = file.getParentFile().getCanonicalFile(); canon = new File(canonDir, file.getName()); ... |
boolean | isSymlink(File file) Checks whether a file is a symbolic link. File parent = file.getParentFile(); File test = new File(parent.getCanonicalFile(), file.getName()); return !test.getAbsolutePath().equals(test.getCanonicalPath()); |
boolean | isSymlink(File file) is Symlink Preconditions.checkNotNull(file); File fileInCanonicalDir = null; if (file.getParent() == null) { fileInCanonicalDir = file; } else { fileInCanonicalDir = new File(file.getParentFile().getCanonicalFile(), file.getName()); return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile()); ... |
boolean | isSymLink(File symlinkFile) Check if a file is a symbolic link or not try { File canonicalFile = null; if (symlinkFile.getParent() != null) { File canonicalDir = symlinkFile.getParentFile().getCanonicalFile(); canonicalFile = new File(canonicalDir, symlinkFile.getName()); } else { canonicalFile = symlinkFile; return !canonicalFile.getCanonicalFile().equals(canonicalFile.getAbsoluteFile()); } catch (IOException e) { return false; |
boolean | isSymlink(final File file) Attempt to determine if a file is a symlink. return !(file.getAbsolutePath().equals(file.getCanonicalPath()));
|
boolean | isSymlink(final String path) is Symlink final File file = new File(path); final File fileInCanonicalDir; if (file.getParent() == null) { fileInCanonicalDir = file; } else { fileInCanonicalDir = new File(file.getParentFile().getCanonicalFile(), file.getName()); final File canonicalFile = fileInCanonicalDir.getCanonicalFile(); ... |