Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 240207 - @appdata variable in Equinox configuration
Summary: @appdata variable in Equinox configuration
Status: CLOSED DUPLICATE of bug 241192
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: equinox.framework-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-09 12:35 EDT by Lukasz Milewski CLA
Modified: 2013-12-06 12:40 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukasz Milewski CLA 2008-07-09 12:35:16 EDT
Different versions of Windows have different location of "Application Data" folder, e.g. for Windows XP is "@user.home/Application Data" but for Windows Vista it's "@user.home/Application Data/Roaming". 

Application we're developing has a requirement to store user profile (in our case workspace with application's specific files) in an Application Data directory. For this purpose we need to have ability to specify @appdata (or whatever it would be called) in config.ini of application.

If it's ok by the community, I can provide relevant change in diff format.
Comment 1 Andy Thomas-Cramer CLA 2011-11-22 13:27:25 EST
We've encountered the same limitation for applications built atop the Eclipse RCP. 

There is already support for macros in the *.ini file, such as "@user.home". However, the user's home directory is not the expected location for application data on either Windows or Mac. What we need is a cross-platform macro that refers to a platform-specific location for application data.

From of the comments on the bug report this raised in our application:

=====================================================================

Administrators have tools for backing up and managing these different areas and
placing data in custom locations. Not following standards may break many of the
tools functionality. Because of issues like this, various compatibility
certifications may require using the appropriate sub-directories.

Similar principles should apply to following Apple's guidelines on where to
store application data on Mac OS X.

Basic information:

http://msdn.microsoft.com/en-us/library/ms995853.aspx

Some Java usage tips:

http://stackoverflow.com/questions/1198911/how-to-get-local-application-data-folder-in-java

How to access the proper directories with compatibility for different OS versions:

http://blogs.msdn.com/b/patricka/archive/2010/03/18/where-should-i-store-my-data-and-configuration-files-if-i-target-multiple-os-versions.aspx
Comment 2 Steven Darnell CLA 2012-02-21 18:09:21 EST
If a JNA dependency is acceptable, we adapted this code (http://stackoverflow.com/questions/585534/what-is-the-best-way-to-find-the-users-home-directory-in-java) to look up a CSIDL value from SHGetFolderPath (ok for XP, deprecated for Vista/7).

I assume looking up a KNOWNFOLDERID from SHGetKnownFolderPath would be very similar (ok for Vista/7).
Comment 3 Szymon Ptaszkiewicz CLA 2013-12-06 12:40:07 EST

*** This bug has been marked as a duplicate of bug 241192 ***