hi,
when i use file explorer lib (https://www.b4x.com/android/forum/threads/class-file-explorer-with-visualization.19003/), i get diffrent path for the same selected file.
for example : /mnt/sdcard/1.txt , /sdcard/1.txt, /storage/sdcard/1.txt ...
above all is the same file.
so i can't using compare filename equals and filepath equals to judge the file is same with the exists file.
then i searching web.and find some java code. these code seems can solved this problem.
my question, how can i using these code in b4a? Thanks
when i use file explorer lib (https://www.b4x.com/android/forum/threads/class-file-explorer-with-visualization.19003/), i get diffrent path for the same selected file.
for example : /mnt/sdcard/1.txt , /sdcard/1.txt, /storage/sdcard/1.txt ...
above all is the same file.
so i can't using compare filename equals and filepath equals to judge the file is same with the exists file.
then i searching web.and find some java code. these code seems can solved this problem.
B4X:
public static boolean isSymlink(File file) throws IOException
{
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());
}
return !canon.getCanonicalFile().equals(file.getAbsoluteFile());
}