directory - android: determining a symbolic link -
I'm scanning all the directories starting with "/" to find some specific directories like "MYFOLDER" . However, the folder is that I get double examples of the same folder. This is because a folder is located in "/ mnt / sdcard / MYFOLDER" and there is a symbolic link in "/ sdcard / MYFOLDER" in the same folder.
My question is, "Is anyone Method is to determine whether the folder is a symbolic link or not? Please give me some suggestions ..
How do they essentially (subject): To answer OP question, it is even easier: Public stable boolean throws the symbollink (file file) IOException {File Kanon; If (file.getParent () == faucet) {canon = file; } Other {file canonDir = file.getParentFile (). GetCanonicalFile (); Canon = new file (canondir, file.getName ()); } Return! Canon.getCanonicalFile (). Equal (canon.getAbsoluteFile ()); } Edit Thank you for commenting on LarsH. The above code only checks whether the children's files are symlinks.
SynBink (file file) in public static boolean {Return file.getCanonicalFile (). Equal (file.getAbsoluteFile ()); }
Comments
Post a Comment