Data Save for Apps

Hello wonderful VUO team!

I am starting a discussion rather than a reporting a bug as I’m not sure if it’s something I’m doing incorrectly.

I have included a very simple composition that saves an entered value to a data file (.txt). As a VUO composition it will both ‘save’ and ‘fetch’ from the named file in the root directory (the same directory that the composition file is in.

However, when I export an App, it no longer saves to the file that it creates in the ‘Contents/Resources’ folder, but rather, saves the data to a file it self-creates on my desktop.

Is there some way to ensure that when the ‘app’ is created, it ‘saves’ and ‘fetches’ from the file in the ‘Resource’ directory?

Thank you for looking into this. Any help would be appreciated.

William

Temp Save Setup Test.zip (5.95 MB)

I believe the resource directory is protected by Mac OS inside an app now, so best to save in the user preferences location(??)

Hello Keith,

Would you please explain ‘user preferences location’?

William

@keithlang is basically correct. Since exported apps are ad-hoc code-signed (as required by M1 Macs), trying to save files within the app bundle would cause problems. Instead, you could save the file to a folder such as ~/Library/Application Support/<bundle ID>, ~/Library/Caches/<bundle ID>, ~/Downloads, or whatever would be appropriate according to macOS conventions.

To clarify the current behavior of Save and Fetch nodes when their URL port contains just a file name:

  • When running a composition from the Vuo editor:
    • Fetch nodes look for the file in the folder containing the composition.
    • Save nodes place the file in the folder containing the composition.
  • When running an exported app:
    • Fetch nodes look for the file in the folder containing the composition (Contents/Resources in the app bundle).
    • Save nodes place the file on the Desktop.

When a similar question came up several months ago, we (Vuo developers) internally discussed how we could make this easier, though haven’t made any changes yet. We’re thinking of (1) clarifying the node documentation, (2) modifying Save nodes so they look for the file in the same folder as the exported app, instead of on the Desktop, and (3) allowing URLs such as application-support://foo.png so you don’t have to write out the longer URL ~/Library/Application Support/<bundle ID>/foo.png.