Where to store an app's data file so it can be modified by all users

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Verymuch
Posts: 12
Joined: Sat Oct 30, 2021 1:33 pm

Where to store an app's data file so it can be modified by all users

Post by Verymuch »

Dear forum,

After some searching I've found two locations where an app can store a data file so other users can modify it:

Code: Select all

/Users/Shared/YourApp
and

Code: Select all

/Library/Application Support/YourApp
Which one of the two locations is the best place to use?

Thank you
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Where to store an app's data file so it can be modified by all users

Post by Klaus »

Why not just use -> specialfolderpath("documents") (in a subfolder)?
The average user does not want to mess with/in any Library folder!
Verymuch
Posts: 12
Joined: Sat Oct 30, 2021 1:33 pm

Re: Where to store an app's data file so it can be modified by all users

Post by Verymuch »

Klaus wrote: Wed Oct 19, 2022 4:54 pm Why not just use -> specialfolderpath("documents") (in a subfolder)?
The average user does not want to mess with/in any Library folder!
specialfolderpath("documents") yields a location writable only by the current user.
I would like the data file to be stored where the app can modify the same file when another Mac user is logged in.
Last edited by Verymuch on Wed Oct 19, 2022 5:21 pm, edited 1 time in total.
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Where to store an app's data file so it can be modified by all users

Post by FourthWorld »

/Users/Shared is recommended by Apple Support.
https://support.apple.com/guide/mac-hel ... lp1122/mac

/Library/Application Support requires admin privileges; attempting to write to it without elevating privileges will result in an error 13 ("Permission denied").
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Where to store an app's data file so it can be modified by all users

Post by Klaus »

Oops. sorry, overlooked that.
Well then "/Users/Shared/YourApp" should do.
Verymuch
Posts: 12
Joined: Sat Oct 30, 2021 1:33 pm

Re: Where to store an app's data file so it can be modified by all users

Post by Verymuch »

Thank you. I'll put my file in
/Users/Shared/MyApp
and then i'll use

Code: Select all

shell "chmod o=wrx /Users/Shared/MyApp/Myfile"
to give the other users write access.
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Where to store an app's data file so it can be modified by all users

Post by FourthWorld »

I don't know that it would make much difference in your setup, but I'd be inclined to use "a=" ("all") rather than "o=" ("others").

Also, if the file isn't an executable program I'd leave off "x". Also not likely critical, but the earlier we adopt habits of granting least privilege the better the systems we will deploy over the years ahead.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Verymuch
Posts: 12
Joined: Sat Oct 30, 2021 1:33 pm

Re: Where to store an app's data file so it can be modified by all users

Post by Verymuch »

Thank you Richard for the sound advice. It's much appreciated.
Post Reply