Preferences folder filepath on OSX for pattrstorage

Daniel P's icon

I have made a standalone. On OSX, I would like to store some settings in a pattrstorage in an xml file in the User/Library/Preferences folder.

How do i get that filepath irrespective of where on the system my standalone is running from?

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

Andrew Benson's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Try this. Super handy:

Rob Ramirez's icon

you can use the shell object (found via maxobjects.com) to get the user's name with the "whoami" command. you can construct the path to the preferences folder with this information.

Daniel P's icon

Thenks for the replies.

Andrew: I have tried messing around with the different filepath objects in Max, problem is that it is hard to get consistent results, they are pretty much all dependent on where on the system the patch is running from. Trying out your patch running from the harddrive will not get me a user name, just Harddrive:/my_patch/

Robtherich: That seems nice, but I really like to just use the stock Max objects, and avoid third party externals. For portability.

OSX filpath convention is using a tilde to take you to the current users top level folder, but I can't get Max to recognise it. That would be: ~/Library/Preferences

Now that is super handy! Problem is I can't get it to work.

Arvid Tomayko's icon

I've been playing with this - though the mxj syscommand by Topher Lafata. Since it is an mxj, it should work on any mac, just bundle the mxj with the patch or app.

(but the share page where you can download it does not seem to be back up yet)

I think this should work pretty universally on OS X. There are a few number boxes and an autopattr so you can test.

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