Following code fails to check the shortcut file. code source
Suppose there is file sdcard/1234567.mp3
which is not shortcut file even the absolute and canonical paths are different.
public static boolean isShortcutFile(File file) {
try {
if (!file.exists()) {
return true;
} else {
return !file.getAbsolutePath().equals(file.getCanonicalPath());
}
} catch (IOException ex) {
System.err.println(ex);
return true;
}
}
Alternate way what i tried is checking the extension of a file is .lnk
will it work for all case?