Possible bug in MakeDirectory()

Report any Hollywood bugs here
Post Reply
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Possible bug in MakeDirectory()

Post 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
p-OS
Posts: 167
Joined: Mon Nov 01, 2010 11:56 pm

Re: Possible bug in MakeDirectory()

Post by p-OS »

you have to use \ as separator
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Possible bug in MakeDirectory()

Post 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
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Possible bug in MakeDirectory()

Post 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")
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Possible bug in MakeDirectory()

Post 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
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Possible bug in MakeDirectory()

Post 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 :)
Post Reply