Possible bug in MakeDirectory()

Report any Hollywood bugs here

Possible bug in MakeDirectory()

Postby Allanon » Wed Dec 06, 2017 11:23 am

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

Re: Possible bug in MakeDirectory()

Postby p-OS » Wed Dec 06, 2017 6:12 pm

you have to use \ as separator
p-OS
 
Posts: 79
Joined: Tue Nov 02, 2010 12:56 am

Re: Possible bug in MakeDirectory()

Postby Allanon » Wed Dec 06, 2017 8:12 pm

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
Allanon
 
Posts: 411
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy

Re: Possible bug in MakeDirectory()

Postby jPV » Thu Dec 07, 2017 6:00 pm

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
jPV
 
Posts: 85
Joined: Sat Mar 26, 2016 11:44 am
Location: RNO

Re: Possible bug in MakeDirectory()

Postby airsoftsoftwair » Thu Dec 07, 2017 6:23 pm

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
airsoftsoftwair
 
Posts: 2233
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Possible bug in MakeDirectory()

Postby Allanon » Thu Dec 07, 2017 7:35 pm

@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 :)
User avatar
Allanon
 
Posts: 411
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy


Return to Hollywood bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron