Android Question File.Exists in Windows

drponciano

Member
Licensed User
Longtime User
I'm trying tu use File.Exists in my DirApp directory but always returns false even if the file exists. The problem seems to be the 8.3 naming for the directories. For example, if I look for this file:
name="C:\Fuentes\Basic4Mac\ZiECG_JV\Objects\PDFEcg\ANGEL_MERINO_GUZMAN_1_0.PRM.PDF"
file.exists("",name) returns TRUE but, if I use
file.exists(DirApp,"\PDFEcg\ANGEL MERINO GUZMAN 1_0.PRM.PDF") or
file.exists("","C:\Fuentes\BASIC4~1\ZiECG_JV\Objects\PDFEcg\ANGEL MERINO GUZMAN 1_0.PRM.PDF) it returns FALSE as DirApp is C:\Fuentes\BASIC4~1\ZiECG_JV\Objects

Any idea what am I doing wrong?
 

emexes

Expert
Licensed User
Longtime User
Simplest solution is probably to only use the full (normal, actual) directory names, not the mangled on-the-fly kludgy shortened names that were introduced during the 16-bit-to-32-bit changeover to long file names.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I'm trying tu use File.Exists in my DirApp directory but always returns false even if the file exists. The problem seems to be the 8.3 naming for the directories. For example, if I look for this file:
name="C:\Fuentes\Basic4Mac\ZiECG_JV\Objects\PDFEcg\ANGEL_MERINO_GUZMAN_1_0.PRM.PDF"
file.exists("",name) returns TRUE but, if I use
file.exists(DirApp,"\PDFEcg\ANGEL MERINO GUZMAN 1_0.PRM.PDF") or
file.exists("","C:\Fuentes\BASIC4~1\ZiECG_JV\Objects\PDFEcg\ANGEL MERINO GUZMAN 1_0.PRM.PDF) it returns FALSE as DirApp is C:\Fuentes\BASIC4~1\ZiECG_JV\Objects

Any idea what am I doing wrong?
1.Are you sure your app is running on Android?
file.exists("","C:\Fuentes\BASIC4~1\ZiECG_JV\Objects\PDFEcg\ANGEL MERINO GUZMAN 1_0.PRM.PDF) it returns FALSE as DirApp is C:\Fuentes\BASIC4~1\ZiECG_JV\Objects
2.Why is the path \BASIC4~1\ instead of \Basic4Mac\?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Did you try
B4X:
file.exists(file.append(DirApp, "PDFEcg") ,"ANGEL MERINO GUZMAN 1_0.PRM.PDF")
?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Any idea what am I doing wrong?
Are you sure your app is running on WINDOWS? The paths you mentioned does not exists in Android.

Remember that you are asking a ANDROID-Question here. Or do you really mean Windows and your app is a B4J App?
 
Upvote 0
Top