Where to store application data?

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pderocco
Posts: 44
Joined: Fri May 16, 2008 1:26 am

Where to store application data?

Post by pderocco » Wed Mar 03, 2010 4:20 am

I have a Win/Mac standalone, which stores its configuration data in a file. In Windows, I can put it in $APPDATA under a company name subfolder. What's the equivalent on OS X?
Ciao,
Paul

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Where to store application data?

Post by FourthWorld » Wed Mar 03, 2010 5:31 am

specialFolderPath("asup") will get you to the OS X Application Support folder.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

pderocco
Posts: 44
Joined: Fri May 16, 2008 1:26 am

Re: Where to store application data?

Post by pderocco » Wed Mar 03, 2010 5:35 am

Thanks. Unfortunately, I don't have a Mac handy, as I do all my development on Windows. Is it customary for each software vendor to create a subfolder under that folder, with the same name as the company, and then put its stuff inside that? Are blanks in the folder names usually avoided? I'd just like to get an idea of customary or best practices.
Ciao,
Paul

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Where to store application data?

Post by FourthWorld » Wed Mar 03, 2010 5:57 am

Judging from the folders on my drive is seems the most common convention is to name the folder the same as the app, regardless of whether or not that name contains white space.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Where to store application data?

Post by jmburnod » Thu Mar 04, 2010 7:57 pm

Hi,
If i have understand (i don't speak really english9
I work with Mac but this script work also in a window standalone.

I use this script to read and write data in a folder "LeNecessaire" in the same folder of
the standalone.

Code: Select all

on FaitPathNec
   global gPathNec
   put the filename of this stack into bufPath
   put bufPath into gPathNec
   put the environment into pEnv
   put the itemdel into OID
   set the itemdel to "/"
   put the num of items of gPathNec into nbF
    if the platform = "MacOS" then 
      if pEnv = "standalone application" then
         delete item (nbF-3) to nbf of gPathNec
      end if
      if pEnv = "development" then
         delete last item of gPathNec
      end if
   else
      delete last item of gPathNec --•• standalone window
   end if
   set the itemdel to OID
   put "/"&"LeNecessaire" after gPathNec
end FaitPathNec
I hope this help

Jean-Marc
https://alternatic.ch

pderocco
Posts: 44
Joined: Fri May 16, 2008 1:26 am

Re: Where to store application data?

Post by pderocco » Thu Mar 04, 2010 8:15 pm

The problem with putting things there is that Win Vista and Win7 prevent you from writing to data files in the Programs tree. That's why you now have to put things into the application data part of the tree.

By the way, for what you want to do, you can generate the pathnames more simply just by appending "/../LeNecessaire" or "/../../../LeNecessaire".
Ciao,
Paul

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Where to store application data?

Post by FourthWorld » Thu Mar 04, 2010 8:29 pm

specialFolderPath(26) will get you the path to the current user's Application Data folder on Win XP, Vista, and 7.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

redpill
Posts: 21
Joined: Fri Jan 08, 2010 10:38 pm

Re: Where to store application data?

Post by redpill » Thu Mar 18, 2010 5:56 am

Here is some useful information:

http://developer.apple.com/mac/library/ ... 1-BAJHCHJI

-- and --

http://developer.apple.com/mac/library/ ... 002722-TP6

And, a Note from that page:
Note: If you install additional files when your application is first run, be sure to install them in obvious places, such as in the Application Support directory. Place your resources in a directory named for your application to make it easy for the user to find these files if they ever need to uninstall your application.
Regards,
redpill

Post Reply