saving data (coll) within a built standalone?

chaosmoon's icon

Is there a way to save data within a built standalone app? The coll object allows for writing a file but not for defining a path and will write a text file to the folder containing the standalone. i would like to write to a file within the standalone app/folder.

Luke Hall's icon

In a standalone this should report where the runtime version of max is, in the package you have built to be your application (on mac at least). You can then use [sprintf] to format a specific name and location to send to [coll].

lh

Max Patch
Copy patch and select New From Clipboard in Max.

chaosmoon's icon

nice!

but..

It appears to report the location of the standalone and not the runtime within the standalone. Formatting the standalone-name as folder in sprintf doesn't work and results in the file being written beside the standalone. It would be nice if i could write to a file within the standalone(contents). I'd prefer not to write a pref file somewhere else and keep everything contained within the app.

or is this impossible?

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

It works for me if you change the sprintf to something like:

[sprintf symout %s%s.app/Contents/support/%s.txt]

making sure the ".app" bit is included might be what you were missing.

lh

chaosmoon's icon

working! Thanks.

I wasn't pointing to something like Contents/support but the root/app folder which probably is a nono.

Luke Hall's icon

That might have been the problem, generally Contents/support is where you want to bundle all the related bits that go with your app, even making your own subfolders inside "support" is not a problem. If you want to allow users to add their own folders then look at [filepath] which can temporarily add folders to you app's search path.

lh