Best location for 'shared' files on Mac

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Best location for 'shared' files on Mac

Post by andyh1234 » Tue Sep 23, 2008 4:24 pm

Hi,

We have an application that has a sqllite common database, and a few text files we would like all the users on the mac to be able to access.

If we put them in a users documents folder, then they are not available to the other users and each user ends up creating their own database, and if we put them in a folder in the application package location we get permission errors for the other users.

Any ideas where would be the best location to put the files so all users can access the files, and the best code to get the path to that location.

Thanks!

Andy

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Wed Sep 24, 2008 12:02 pm

Hi andy,

try:
put specialfolderpath("asup")
-> /Library/Application Support

You may create a subfolder there, so this might be the right place for you :-)


Best from germany

Klaus


P.S.
Please check the Rev docs for "specialfolderpath" and especailly the link to the Apple docs (scroll down a bit to see the URL), to get a list of Mac only 4 character "folderidentifiers" to play with.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4000
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Wed Sep 24, 2008 12:35 pm

Hi,
you might also consider
the shared user folder

put specialfolderpath("sdat")

it is accessible for all users. No access problems here but also accessible to every user via the finder. I use it for multi user access.

/Library/Application Support" sounds interesting, is it accessible for every user? is it OK to store data there?, special considerations regarding back up?

cheers
bernd

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Wed Sep 24, 2008 2:10 pm

Hi Bernd,

alles im Lot? :-)
bn wrote:...
/Library/Application Support" sounds interesting, is it accessible for every user? is it OK to store data there?, special considerations regarding back up?
I'm not sure, cannot test it here at work.

What exactly do you mean with "special considerations regarding back up"?

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Wed Sep 24, 2008 2:12 pm

Hi all,

after some tests it looks like:

Code: Select all

specialfolderpath("sdat")
is the place to store stuff, since ALL users can read and write here.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4000
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Wed Sep 24, 2008 2:58 pm

Hi Klaus,

allet paletti :D

Well, regarding backup I meant that I often just backup the users folder, since that is what changes most, and the rest just occasionally, which, I know, I know, it is bad practice, just something to take into consideration when one is not in control of the machine/environment.

all the best to Germany from Germany :)


bernd

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Wed Sep 24, 2008 3:59 pm

Thanks everyone!

Andy

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Wed Sep 24, 2008 4:41 pm

Just following on.

Ive tried both the sdat and asup options, with interesting effects, not what I had wanted or expected from a shared area.

The main user can read and write to the files in either folder using the sqllite revdb stuff, but the other users still can't, it generates a RevExternalLibrary exception.

Other apps in the second user can read the files just fine which shows the files are readable, just not sure with my app with Runrev wont read them.

Any ideas?

Andy

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4000
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Wed Sep 24, 2008 5:22 pm

andy,

look at the permissions of the db file using either the info (activate the file then command-i) or use the terminal. Maybe Rev sets the permissions to the main user and lets others read. Try to change the permissions so everyone can read and write, check the permissions for the shared folder also. Just a guess since I never used a db in the shared folder.

regards
bernd

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Wed Sep 24, 2008 6:12 pm

I think you have hit the nail on the head bernd.

The file has read/write permission for the first user, and just read for the other users.

So, the next question is does anyone know how a simple way to change the permissions on a specific file or folder so all users can access it with read/write permissions.

Ideally Id just run a command / subroutine on that folder to change all files to read/write by all, they are not 'private' files.

Thanks

Andy

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4000
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Wed Sep 24, 2008 7:11 pm

Andy,

if it is a one time job it is easy. You have to have administrator rights to change permissions. If you have physical access to the machine, go to the files in the finder, get Info and change the permissions to what you want. It will ask for an administrator password. And that should be it. Rev is probably not going to change the rights back if it writes to the files.
If you want to deploy the app, you could go with either an applescript or a shell command. both need the administator password. With applescript I could help you, with the shell script it would be worth to search the list. Gmaine or Nabble. It is a common problem. There should be shell commands you can issue from Revolution for that. Or someone in this forum can chime in and shed some light/script on this matter...

regards
Bernd

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Wed Sep 24, 2008 7:44 pm

Thanks again.

The command...

Code: Select all

     
if the platform is "MacOS" then
         get shell("chmod 777" && quote & tFilePath & quote)  
      end if
seemed to work just fine as long as the user creating the files in the first place is an administrator.

If the user is a 'standard' user, they cant even create a file in the asup area in the first place, so I cant chmod it unless its created.

I think I might just stick with what I have - the files in the users documents folder, that works, just doesnt share the data between users.

Thanks again for trying!

Andy

Post Reply

Return to “Mac OS”