Directory separators

Discuss any general programming issues here
Post Reply
User avatar
jPV
Posts: 734
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Directory separators

Post by jPV »

Hollywood converts both slashes and backslashes in file operations as directory separators, but can you bypass this feature in any way and force it to use only one separator?

I have some issues because on Amiga compatibles you can have directory and file names that contain backslashes. For example, filesysbox under MorphOS converts unknown non-printable characters to \xHEXA format, which contains the backslash in file/dir names then. If you mount a network share that contains some alien charset/characters that get converted to this \x format, they fail with Hollywood's functions.

Here's an example:

Code: Select all

f$ = "ram:test\\file"
Execute("Touch", f$)       ; Creates "ram:test\file" file
DebugPrint(f$, Exists(f$)) ; Exists return 0
s$ = FileToString(f$)      ; Cannot read file
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Directory separators

Post by airsoftsoftwair »

Makes sense. I can add a command that allows scripts to turn off interpreting backslashes as directory separators on non-Windows systems. That should fix the problem.
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Directory separators

Post by airsoftsoftwair »

Code: Select all

- New: Added AllowBackslash() function to Hollywood's DOS library; if you pass TRUE to this function, all
  of Hollywood's DOS commands won't automatically map the backslash to a slash character; this can be
  useful on non-Windows systems where the backslash character is a normal character that can be used in
  filenames
Post Reply