Roger Daley Well-Known Member Licensed User Longtime User Oct 25, 2019 #1 Hi All, I have been chasing down how to detect/correct if a user uses uppercase instead of lowercase to name a file. I had this as a concern on the understanding Android is case sensitive. Point is moot. After many puzzling outcomes I ran this sub. The file IMPSITELIST.CSV is in Dir ABT, no lowercase equivalent is there. The file is found whether File.Exist uses Uppercase or lowercase. Does anybody know how to tell if a function in B4A is actually case sensitive? Regards Roger Code: Copy Sub BtnSiteListPlus_click If File.Exists(File.DirRootExternal&"/ABT/", "impsitelist.csv") Then Log("lowercase found") If File.Exists(File.DirRootExternal&"/ABT/", "IMPSITELIST.CSV") Then Log("UPPERCASE FOUND")
Hi All, I have been chasing down how to detect/correct if a user uses uppercase instead of lowercase to name a file. I had this as a concern on the understanding Android is case sensitive. Point is moot. After many puzzling outcomes I ran this sub. The file IMPSITELIST.CSV is in Dir ABT, no lowercase equivalent is there. The file is found whether File.Exist uses Uppercase or lowercase. Does anybody know how to tell if a function in B4A is actually case sensitive? Regards Roger Code: Copy Sub BtnSiteListPlus_click If File.Exists(File.DirRootExternal&"/ABT/", "impsitelist.csv") Then Log("lowercase found") If File.Exists(File.DirRootExternal&"/ABT/", "IMPSITELIST.CSV") Then Log("UPPERCASE FOUND")
Erel B4X founder Staff member Licensed User Longtime User Oct 25, 2019 #2 File.Exist calls the system API. The behavior depends on the file system behavior. If the case is important for you then use File.ListFiles instead. Upvote 0
File.Exist calls the system API. The behavior depends on the file system behavior. If the case is important for you then use File.ListFiles instead.
Roger Daley Well-Known Member Licensed User Longtime User Oct 25, 2019 #3 Erel, It is not so much the case being important to me, it is if the user uses the wrong case will it affect the program. From the example above it would appear that File.Exists is not a problem but... I have just run code containing: Code: Copy If File.Exists(File.DirRootExternal&"/ABT/", "impsitelist.csv") = False Then CustomToastMsg.Show("File 'impsitelist.csv' not found",1000,Gravity.TOP,0,25%y) End If The CustomToastMsg is displayed, this is very confusing. The critical point in the code is: Code: Copy Table = su.LoadCSV(File.DirRootExternal&"/ABT/", "impsitelist.csv",",") This appears to be case sensitive, perhaps I need to revisit detecting/correcting filenames in the wrong case. This is going to lead to many more questions as I don't seem to be able to get this working. Regards Roger the baffled. Upvote 0
Erel, It is not so much the case being important to me, it is if the user uses the wrong case will it affect the program. From the example above it would appear that File.Exists is not a problem but... I have just run code containing: Code: Copy If File.Exists(File.DirRootExternal&"/ABT/", "impsitelist.csv") = False Then CustomToastMsg.Show("File 'impsitelist.csv' not found",1000,Gravity.TOP,0,25%y) End If The CustomToastMsg is displayed, this is very confusing. The critical point in the code is: Code: Copy Table = su.LoadCSV(File.DirRootExternal&"/ABT/", "impsitelist.csv",",") This appears to be case sensitive, perhaps I need to revisit detecting/correcting filenames in the wrong case. This is going to lead to many more questions as I don't seem to be able to get this working. Regards Roger the baffled.