0

I have a file util which detects if the file is a symbolic link. I more or less use the code presented here. It works fine for almost all files in Android. I run into problems, however, with a legacy folder. The legacy folder is a symbolic link to the file the user is actually on (This is for Android devices running 4.2.2 or higher which allows for multiple users). For example the path will be "storage/emulated/legacy/file" but when run through the isSymbolicLink method, I get false returned. This is because the file.getCanonicalPath() does not seem to resolve the symbolic link for the /legacy folder. Does anybody have an idea on how to detect /legacy as a symbolic link? I'm really trying to avoid just coding in "legacy folder is a symbolic link, deal with it". Let me know what you think.

Edit: It seems like I've run into the same problem as this question.

Community
  • 1
  • 1
kevin.w.johnson
  • 1,684
  • 3
  • 18
  • 37
  • That's probably because you're testing `file`. even if you reach the file via a symlink, that file itself ISN'T a symlink. if you test `storage/emulated/legacy`, you'd get true... – Marc B Jan 30 '14 at 16:44
  • I'll give that a shot. If this is true though, why would it work for all other symbolic links? The getCanonicalPath() method should resolve symbolic links in the path. – kevin.w.johnson Jan 30 '14 at 16:48

0 Answers0