Preferences folder filepath on OSX for pattrstorage

Nov 27, 2009 at 8:28pm

Preferences folder filepath on OSX for pattrstorage

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?

– Pasted Max Patch, click to expand. –
#46777
Nov 27, 2009 at 8:48pm

Try this. Super handy:

– Pasted Max Patch, click to expand. –
#168255
Nov 27, 2009 at 9:31pm

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.

#168256
Nov 28, 2009 at 9:57am

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.

#168257
Nov 28, 2009 at 7:04pm

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.

http://www.maxobjects.com/?v=objects&id_objet=3090&requested=syscommand&operateur=AND&id_plateforme=0&id_format=0

(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.

– Pasted Max Patch, click to expand. –
#168258

You must be logged in to reply to this topic.