Page 1 of 1

Where to store application data?

Posted: Wed Mar 03, 2010 4:20 am
by pderocco
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?

Re: Where to store application data?

Posted: Wed Mar 03, 2010 5:31 am
by FourthWorld
specialFolderPath("asup") will get you to the OS X Application Support folder.

Re: Where to store application data?

Posted: Wed Mar 03, 2010 5:35 am
by pderocco
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.

Re: Where to store application data?

Posted: Wed Mar 03, 2010 5:57 am
by FourthWorld
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.

Re: Where to store application data?

Posted: Thu Mar 04, 2010 7:57 pm
by jmburnod
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

Re: Where to store application data?

Posted: Thu Mar 04, 2010 8:15 pm
by pderocco
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".

Re: Where to store application data?

Posted: Thu Mar 04, 2010 8:29 pm
by FourthWorld
specialFolderPath(26) will get you the path to the current user's Application Data folder on Win XP, Vista, and 7.

Re: Where to store application data?

Posted: Thu Mar 18, 2010 5:56 am
by redpill
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