file paths in standalone applications
I'm trying to build a standalone application. At present, the patcher lives in a folder in which are all the sound files that it uses.
The folder is in my home folder (mac).
I've been trying all manner of things to make the application so it can work on other peoples computers with their differently named home folders, i.e. to make it work independently of being in any specific named location. This is a file path problem I guess, maybe they have absolute paths and need relative ones, but I can't get it to work. Any advice ?
Thanks,
Jem
if you are storing anything on the home folder i would suggest using [shell] message into that object "whoami". That will give you the home folder name. YOu can then create your path using the sprintf object and newly found homefolder path. (shell obj is found at CNMAT collection of MaxMsp externals).
To find the application path create a messagebox with "; Max sendapppath path", then create a receive object (NOT 'r' but 'receive') with path as its routing (aka new obj "receive path").
Hope that helps,
Protocol
As an alternative for the shell object, you could send the message Desktop to the absolutpath object.
Thanks, I'll try these strategies . . .
Jem
Thinking about this - is there not a way to simply set a file path relative to an enclosing folder. So the application would be within the folder alongside the files it needs ?
Jem
@Jem: If you want to set the file path relative to an enclosed folder I would suggest sending the Max Message 'SendApppath', if its going to be a standalone, that would find that path of the Standalone directly which would be the folder its in (if its in a folder) - aka the path with all the files it needs then you're golden for finding/reading/writing all the files it needs if its there. I would do that over the [shell] or [absolutepath] shinannagins.
@jvkr: Wicked suggestion, thanks! I can now get rid of using the [shell] object as that was what i used it for. Its nice to finally be free of 3rd party externals! Thank you!
thanks a lot, this sounds a lot more straightforward.
Jem