PB 5.73 LTS
I do not know if this is a bug or not.
FileSize() and OpenFile are not case sensitive.
Using the following code:-
Code: Select all
Macro FileExists1(filename)
Bool(FileSize(fileName) > -1)
EndMacro
Procedure.I FileExists2(Filename.S)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
ProcedureReturn PathFileExists_(Filename)
CompilerCase #PB_OS_Linux
Protected UTF8Filename.S = Space(StringByteLength(Filename, #PB_UTF8) + 1)
PokeS(@UTF8Filename, Filename, -1, #PB_UTF8)
ProcedureReturn g_file_test_(UTF8Filename, #G_FILE_TEST_EXISTS)
CompilerCase #PB_OS_MacOS
ProcedureReturn CocoaMessage(0, CocoaMessage(0, 0,
"NSFileManager defaultManager"),
"fileExistsAtPath:$", @Filename)
CompilerEndSelect
EndProcedure
Define MyOpenFile.i,MyGoodFile.s,MyBadFile.s
MyGoodFile = GetUserDirectory(#PB_Directory_Documents) + "TI Media/A Place To Bury Strangers/" + "A Place To Bury Strangers - I Lost You.ogg"
MyBadFile = GetUserDirectory(#PB_Directory_Documents) + "TI Media/A Place to Bury Strangers/" + "A Place to Bury Strangers - I Lost You.ogg"
Debug MyGoodFile
Debug FileSize(MyGoodFile)
Debug FileExists1(MyGoodFile)
Debug FileExists2(MyGoodFile)
MyOpenFile = OpenFile(#PB_Any,MyGoodFile)
Debug MyOpenFile
CloseFile(MyOpenFile)
Debug MyBadFile
Debug FileSize(MyBadFile)
Debug FileExists1(MyBadFile)
Debug FileExists2(MyBadFile)
MyOpenFile = OpenFile(#PB_Any,MyBadFile)
Debug MyOpenFile
CloseFile(MyOpenFile)
Both filenames return the same they both exist and they can both be opened but only the MyGoodFile actual exists.
The difference is the lower case t in the baffle name.
Makes Filesize etc unreliable.
CD