I'm having trouble setting the current directory whilst using the OS X version of Blitz Max because of an escape string conflict.
I wish to store a file in the users home/library/preferences, the home directory is usually accessed via a tilde character, which in BlitzMax is an escape sequence, putting a single tilde on the path makes the compiler state that it is a bad escape sequence string.
Putting two tilde characters tries to change the directory to a folder with two tilde's in it. At least I think that's why it's failing.
Am I doing something wrong, is there another way to access the home folder bearing in mind the user folder is always named differently?
I have tried using chr(126) to send the ASCII code in place, but that also fails - although with a single chr(126) the program does still compile (id expect this to work) but still fails to set the home directory.
This hack of readdir.bmx should show the problem i'm having.
I wish to store a file in the users home/library/preferences, the home directory is usually accessed via a tilde character, which in BlitzMax is an escape sequence, putting a single tilde on the path makes the compiler state that it is a bad escape sequence string.
Putting two tilde characters tries to change the directory to a folder with two tilde's in it. At least I think that's why it's failing.
Am I doing something wrong, is there another way to access the home folder bearing in mind the user folder is always named differently?
I have tried using chr(126) to send the ASCII code in place, but that also fails - although with a single chr(126) the program does still compile (id expect this to work) but still fails to set the home directory.
This hack of readdir.bmx should show the problem i'm having.
' readdir.bmx DebugLog ChangeDir(Chr(126)+"/Library/Preferences/") 'Returns 0 DebugLog ChangeDir(Chr(126)+Chr(126)+"/Library/Preferences/") 'Returns 0 'DebugLog ChangeDir("~/Library/Preferences/") 'Wont compile, 'bad escape sequence in string' DebugLog ChangeDir("~~/Library/Preferences/") 'Returns 0 dir=ReadDir(CurrentDir()) If Not dir RuntimeError "failed to read current directory" Repeat t$=NextFile( dir ) If t="" Exit If t="." Or t=".." Continue Print t Forever CloseDir dir