Hi there;
I'm currently working on a project in which people should be able to save their stuff in the user's documents dir. However how do you do that in BMax on MacOS.
I know the standard unix prefix for the userdir is ~, but BMax doesn't recognize it as so and appears to be looking for a dir named "~" that (of course) doesn't exist.
Is there another way to do this?
In a terminal app type: "cd ~"
works same like in other unix OS's.
I don't know why this won't work in BlitzMax ... but it should .... :-/
[Edit]
try this: $userDir
does that work ?
The terminal command "cd ~" works, but it's more that I'd like to do it this way.
File = WriteStream("~/myappdocs/document")
Well, that doesn't work, as BlitzMax doesn't see "~" as the user directory.
I've now done it on the "ugly" method...
Like this
(pseudo code. Not real code)
MakeBat "GetUserDir.bat","cd ~\npwd > /AppDir/UserDir.txt"
RunBat "GetUserDir"
UserDir = ReadString("/AppDir/UserDir.txt"
As I said peudo code, but you get the picture.
It is the "ugly" method, so if there's an official method, I'd like to know.
($userDir only got me errors)
Ok - Sorry i don't know too :-)
Checkout Brucey's "volumes" mod:
A small cross-platform module for retrieving volume and directory information for the current system.
Also allows standard access to various user directories such as Home, Documents, Desktop and Application Data (Support on Mac).
The Application directory is where apps can store user-specific resources and such-like.
http://www.brucey.net/programming/blitz/index.php#bahvolumes
Thanks a lot, Winni...
That covers my need ;)
i can get my home folder with: getenv_("HOME")
No need for a module then :-)
[Edit]
this works for me:
file=OpenFile(getenv_("HOME") + "/test.txt")
Your Example should be:
File = WriteStream(getenv_("HOME") + "/myappdocs/document")
HOME is an environment variable...
Bruceys-Mac-Mini:en brucey$ echo $HOME
/Users/brucey
Bruceys-Mac-Mini:en brucey$ export HOME=Woohoo
Bruceys-Mac-Mini:en brucey$ echo $HOME
Woohoo
Using APIs guarantees that things are where they are meant to be. Otherwise, why would we have APIs?
Ah okay - that makes sense.
Thanks Brucey! :-)