Discussion:
User Application Support folder on OS X?
Trevor DeVore
2005-02-18 21:43:12 UTC
Permalink
In my program I have some "current user" specific stack files that get
updated while using the app. On Windows I stored these in the users
application data folder. On Mac I want to store them in the users
Application Support folder (~/Library/Application Support).

The problem is that I can't get specialFolderPath to return this
folder. If you use specialFolderPath("asup") then you get the system
Application Support folder (/Library/Application Support). It seems
that Revolution passes the system domain to FSFindFolder by default.

For the time being I've resorted to storing the stacks in the user pref
folder but it pains me to do so. So does anybody know if it is
possible to get system folders using shell? If not then I will have to
write a little external to do this.
--
Trevor DeVore
Blue Mango Multimedia
***@mangomultimedia.com
Andre Garzia
2005-02-18 22:00:57 UTC
Permalink
On Mac I want to store them in the users Application Support folder
(~/Library/Application Support).
Trevor,

I don't understand the problem, ~/Library/Application Support/ will
always point to the current user app support folder, why can't you use
it? That folder will always be present, and will always be on the same
place... okay, specialFolderPath will not return this folder, but you
will probably have different routines for both mac and win32 when it
comes to finding where to store data, so you can make win32 report
whatever place you want and hard code ~/Library/application support/ on
the mac, can't you?

There probably is someway to return that folder using 'defaults' or
'scutil' shell commands but since you know the folder in the first
place, why bother finding some way to return it?

Cheers
andre
--
Andre Alves Garzia  2004
Soap Dog Studios - BRAZIL
http://studio.soapdog.org
Trevor DeVore
2005-02-18 22:09:48 UTC
Permalink
Post by Andre Garzia
I don't understand the problem, ~/Library/Application Support/ will
always point to the current user app support folder, why can't you use
it? That folder will always be present, and will always be on the same
place... okay, specialFolderPath will not return this folder, but you
will probably have different routines for both mac and win32 when it
comes to finding where to store data, so you can make win32 report
whatever place you want and hard code ~/Library/application support/
on the mac, can't you?
There probably is someway to return that folder using 'defaults' or
'scutil' shell commands but since you know the folder in the first
place, why bother finding some way to return it?
Is it the same for all languages running OS X? I once hard coded a
small portion of a path on Windows. In Spanish one of the folders that
I hardcoded was the name of the folder in Spanish. Needless to say my
path did not work on Spanish systems. That made me sad. I vowed never
to hardcode a folder that the operating system provides an API to
retrieve.

Now if OS X is different then windows in that the folder structure is
always the same regardless of language then that might be different.
But can a user move their application support folder? Is it possible
that the user support folder could be on a server in a networked
environment? I don't know the answers to these questions but I know it
won't matter if I use the API call.
--
Trevor DeVore
Blue Mango Multimedia
***@mangomultimedia.com
Dave Cragg
2005-02-19 23:36:40 UTC
Permalink
Post by Trevor DeVore
In my program I have some "current user" specific stack files that get
updated while using the app. On Windows I stored these in the users
application data folder. On Mac I want to store them in the users
Application Support folder (~/Library/Application Support).
The problem is that I can't get specialFolderPath to return this
folder. If you use specialFolderPath("asup") then you get the system
Application Support folder (/Library/Application Support). It seems
that Revolution passes the system domain to FSFindFolder by default.
For the time being I've resorted to storing the stacks in the user
pref folder but it pains me to do so. So does anybody know if it is
possible to get system folders using shell? If not then I will have
to write a little external to do this.
Could you first get the user's home folder, and then append what is
returned from specialFolderPath("asup")?

Cheers
Dave
Trevor DeVore
2005-02-20 05:34:26 UTC
Permalink
Post by Dave Cragg
Could you first get the user's home folder, and then append what is
returned from specialFolderPath("asup")?
It seems that this would work given the current location of the user
application support folder but I still haven't come across any docs (I
haven't looked that hard yet) that discuss whether this folder can be
moved in network environments, if it changes based on the language,
etc. I did find the following though in the Apple docs:

"Your code should never assume the path to a resource within a
file-system domain, as those paths could change in the future. Apple
provides public interfaces for accessing standard file-system paths.
You should always use these interfaces to locate system resources. See
“Searching Within the File-System Domains” for more on searching for
items within the domains."

I just went ahead and wrapped up FSFindFolder (I'm pretty sure this is
what specialFolderPath uses on Mac) in an external for the time being
and filed a feature request for an optional additional parameter to
specialFolderPath that would allow you to specify the domain to search
under (user,network,local,system).
--
Trevor DeVore
Blue Mango Multimedia
***@mangomultimedia.com
Dave Cragg
2005-02-20 07:45:53 UTC
Permalink
Post by Trevor DeVore
Post by Dave Cragg
Could you first get the user's home folder, and then append what is
returned from specialFolderPath("asup")?
It seems that this would work given the current location of the user
application support folder but I still haven't come across any docs (I
haven't looked that hard yet) that discuss whether this folder can be
moved in network environments, if it changes based on the language,
"Your code should never assume the path to a resource within a
file-system domain, as those paths could change in the future. Apple
provides public interfaces for accessing standard file-system paths.
You should always use these interfaces to locate system resources. See
“Searching Within the File-System Domains” for more on searching for
items within the domains."
I just went ahead and wrapped up FSFindFolder (I'm pretty sure this is
what specialFolderPath uses on Mac) in an external for the time being
and filed a feature request for an optional additional parameter to
specialFolderPath that would allow you to specify the domain to search
under (user,network,local,system).
Just as well. I checked on my wife's account which uses Japanese.
Oddly, the "Library" folder at the System level is in Japanese, but at
the user level it is in English.

Dave

Loading...