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 » Wed Oct 19, 2022 4:46 pm

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: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » 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!

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 » Wed Oct 19, 2022 5:12 pm

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: 9833
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Wed Oct 19, 2022 5:16 pm

/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: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Wed Oct 19, 2022 5:18 pm

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 » Wed Oct 19, 2022 5:25 pm

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: 9833
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Wed Oct 19, 2022 5:39 pm

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 » Wed Oct 19, 2022 5:45 pm

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

Post Reply

Return to “Mac OS”