Codesigned Max standalone will not save presets to disk
Andrew Milne
Apr 19 2023 | 9:31 am
I can build a standalone of XronoMorph – https://www.dynamictonality.com/xronomorph.htm – and it works perfectly on my Macbook Pro. However, when I codesign the app and attempt to save a preset, the preset json file (in XronoMorph.app/Contents/Resources does not get written to). Does anyone have any suggestions as to the cause or any possible solutions?
- Source AudioApr 19 2023 | 11:41 amIf your app is located in /Applications folder, and you have not disabled apple gatekeeper, or given your app full disk access rights, then it can not write into app resources.you could instead write into documents folder or in your app's preferences folder, that should be allowed.
- Andrew MilneApr 19 2023 | 12:28 pmI may be wrong, but I think I have given the app disk access rights. But moving the app to Downloads, Desktop, Documents, or Applications makes no difference – changes won't write to the presets json in the Resources folder. So I am a bit confused as to why this is happening.
- Source AudioApr 19 2023 | 1:15 pmIt is not moving the app, but write destination for json file. By the way, are you using absolute path ? not just write presets.json, but write /Appications/MyApp.app/Conents/Resources/presets.json
- Andrew MilneApr 19 2023 | 2:31 pmThe preset json is first read in and then the writeagain message is used to save any changes. The read message specifies only the name of the preset file with no path at all. This seems to work fine for the standalone, but writing breaks when the app is codesigned. Tomorrow, I will try specifying a relative path (I prefer relative to absolute so the user can put the app wherever they like) and see if that makes any difference although it's not clear to me why it would.
- Source AudioApr 19 2023 | 3:11 pmone would expect that writeagain works, but it did not work for me since quite few max versions, so I gave it up, and use absolute path. Your preset file is in same location as mxf file, you can send path message to thispatcher on load
- Andrew MilneApr 20 2023 | 8:20 amUsing absolute paths solved the problem – presets are now saving in the codesigned version of the standalone. Thank you for your advice! One thing to note is that sending "path" to [thispatcher] does not seem to work for standalones. But the path can be obtained by sending a sendapppath message to Max, as in this adapted version:It's a slightly annoying design because it does not work for the patch running in Max. I wonder if there is any way to get a single solution for patches, standalones, and codesigned standalones?
- Source AudioApr 20 2023 | 9:41 ampath to thispatcher will give you both - path to main patcher while editing, and path to mxf in standalone. but if that for some reason does not work for you,
- Andrew MilneApr 20 2023 | 10:08 amAh, that's neat! I wasn't aware of the getruntime message. Thank you.
- Source AudioApr 21 2023 | 7:00 amCould you post what path does path message to thispatcher output for you in signed standalone ? You mentioned that it does not work properly. It interests me because I don't use systems > High Sierra, and also don't sign standalones...
- Andrew MilneApr 22 2023 | 1:03 amI am on macOS Ventura 13.3.1 with Max 8.5.4. Sending "path" to [thispatcher] works as expected in a patch but, in a standalone (whether or not codesigned), the output is only a forward slash: /
- Source AudioApr 22 2023 | 9:27 amThanks for the infos. I tested today max 8.5.3 standalone on High Sierra, path to this patcher displays correctly absolute path to resources folder. If you insert conformpath max absolute ?
- Andrew MilneApr 23 2023 | 8:27 amOdd, but it seems that adding [deferlow] to delay the [loadbang] sending "path" to [this patcher] gets this method to work for a not-codesigned standalone (I have not yet tested a codesigned version). Patch attached.
- Source AudioApr 23 2023 | 12:39 pmyou can safely add one or few seconds of delay to get the path.... messages have the argument not to restore contents ... spares closebang object