Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 426189

Summary: osgi.baseConfiguration.area and -configuration does not resolve using a relative path
Product: [Eclipse Project] Equinox Reporter: Steven Darnell <darnells>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: 3.8.2 JunoKeywords: helpwanted
Target Milestone: Luna M6   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Steven Darnell CLA 2014-01-20 16:07:52 EST
My company produces a small suite of RCP applications that are installed into the same shared location on Windows (C:\Program Files (x86)\MyCompany). We desire that they share a plug-ins directory but have separate configuration areas. We observe the following when defining 'osgi.baseConfiguration.area' with a relative path:

* If the working directory is in installation directory when the application is launched (e.g. double-click the exe in Windows Explorer, use a shortcut with the "Start in" variable defined as the installation directory), the relative path for 'osgi.baseConfiguration.area' is resolved to the correct absolute path and 'osgi.configuration.area' is set to the location as defined in config.ini. We are using the ability to specify environment variables as introduced in Bug 241192, so the launcher ini file cannot be used.

* If the working directory is not the installation directory (e.g. open the application by double-clicking a file in Explorer associated with the program, launch from the command line from any non-installation directory), the program launches but 'osgi.baseConfiguration.area' is still listed as a relative path and osgi.configuration.area reverts to its fallback position (for admins: C:/Program Files (x86)/MyCompany/configuration, for users: %USERPROFILE%/.eclipse/configuration).

* The desired behavior is achieved if 'osgi.baseConfiguration.area' is defined by an absolute path.

* 'osgi.user.area' and 'osgi.instance.area' are correctly set in both instances.

While searching for solutions on why I could not use a relative path to define the location of osgi.baseConfiguration.area in eclipse.ini/PRODUCT.ini, I came upon this StackOverflow question: Can Eclipse launcher ini -configuration variable take a relative path? (http://stackoverflow.com/questions/11732006)

It suggests that bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/LocationManager:buildLocation (pre-3.10, now called bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/location/EquinoxLocations) is the culprit.

I request that a relative path is honored when used to define osgi.baseConfiguration.area or -configuration in the launcher ini file. Example ini files for my situation are found in my original Equinox forums post: http://www.eclipse.org/forums/index.php/t/637634/
Comment 1 Thomas Watson CLA 2014-01-22 12:45:38 EST
What you describe makes sense, but I am wondering if you have a proposal for a solution? The osgi.baseConfiguration.area is read by the equinox launcher in the processConfiguration method [1]

It seems this is where we need to detect that the property is a relative path and base it off the install location if so.  I guess the code should call org.eclipse.equinox.launcher.Main.ensureAbsolute(String) similar to what is done for osgi.sharedConfiguration.area in the same method.

[1] http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java#n1747
Comment 2 Thomas Watson CLA 2014-01-22 12:50:25 EST
Target for M6, but would be great to get a contribution for this one.
Comment 3 Thomas Watson CLA 2014-01-22 12:52:59 EST
I forgot to mention.  I don't really want to treat relative paths for -configuration as relative to the install location because that will break current behavior for when calling eclipse -configuration <myconfig folder> from a directory that has all your configurations.
Comment 4 Thomas Watson CLA 2014-02-24 10:04:30 EST
I went ahead and made a call to make sure the osgi.baseConfiguration.area property is absolute:

http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=34dbbd148efba5b5a398ffbd1848e38aae829709