Page 1 of 1

Possible bug in MakeDirectory()

Posted: Wed Dec 06, 2017 11:23 am
by Allanon
Hi Andreas,
I think I've spotted a bug in the MkaeDIrectory() function.

It fails if the last character of a directory name is a space, here are two examples:

Code: Select all

; These will fail
MakeDirectory("C:/Test/prova ")
MakeDirectory(""C:/Another/test /hello")
I'm getting error 1084, "Error creating directory <dirname>..."

I'm on Windows 10 64bit

Re: Possible bug in MakeDirectory()

Posted: Wed Dec 06, 2017 6:12 pm
by p-OS
you have to use \ as separator

Re: Possible bug in MakeDirectory()

Posted: Wed Dec 06, 2017 8:12 pm
by Allanon
p-OS wrote:you have to use \ as separator
That's not the problem, using backslash is for embedding special characters, for example double quotes :)

Code: Select all

; Print double quotes
Print("\" <- double quotes")
The same exact command in the first post works if I remove the trailing space of the forlder name:

Code: Select all

MakeDIrectory("C:/test") ; <- works
MakeDirectory("C:/test ") ; <- does not work
At least here under Windows 10

Re: Possible bug in MakeDirectory()

Posted: Thu Dec 07, 2017 6:00 pm
by jPV
These DO work under MorphOS:

Code: Select all

; Works!
MakeDirectory("RAM:bla ")
MakeDirectory("RAM:bla2 /blo")
...so maybe it's filesystem or OS dependant issue. Are you sure your filesystems should support that kind of names? I remember that at least FAT went belly up with directories ending to ".", for example :)

BTW. there's one extra " in the original example:
MakeDirectory(""C:/Another/test /hello")

Re: Possible bug in MakeDirectory()

Posted: Thu Dec 07, 2017 6:23 pm
by airsoftsoftwair
jPV is right. I don't think Windows supports filenames that end in a blank space. I can't create a directory using Explorer ending in a blank space either. It is automatically stripped. AmigaOS is less strict about this. AFAIR it even allows you to create files whose names consist of spaces only :P

Re: Possible bug in MakeDirectory()

Posted: Thu Dec 07, 2017 7:35 pm
by Allanon
@jPV & @airsoftsoftwair

Ops, you are both right! The trailing spaces are stripped automatically by the OS...
Well... I've to dig into this a bit more... it was caused while testing the new AmiCloud client with folder support, so I've to find out from where these spaces are coming :P
Thank you for the hint :)

@jPV
the double double-quote was a transcription error :)