CheckFilename bug?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Piero
Addict
Addict
Posts: 914
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

CheckFilename bug?

Post by Piero »

Code: Select all

; MacOS
; From help: Checks if the specified Filename$ doesn't contain invalid characters for the file-system.
Debug CheckFilename(~"'\"") ; 1
Debug CheckFilename(~"/'\"") ; 0
Debug CheckFilename("a") ; 1
Debug CheckFilename("/a"); 0
Note:
I just renamed a folder to: "/\"
I mean, INCLUDING THE DOUBLE QUOTES! :mrgreen:
User avatar
Piero
Addict
Addict
Posts: 914
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: CheckFilename bug?

Post by Piero »

After further testing, I won't call it a (MacOS PB) bug, because "/" obviously generates an error if on a file name STRING…
But see:

Code: Select all

; Open a file whose name contains a "/"
ss.s=OpenFileRequester("","","",0)
s.s= GetFilePart(ss)
Debug s
Debug CheckFilename(s) ; "/" becomes ":", invalid in Finder, but it's ok here! (1)
Debug GetFileDate(ss,#PB_Date_Created) ; works!
Axolotl
Addict
Addict
Posts: 832
Joined: Wed Dec 31, 2008 3:36 pm

Re: CheckFilename bug?

Post by Axolotl »

AFAIK not possible on windows.
see also my answer at your GetFilePart
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Post Reply