Community
Participate
Working Groups
I wanted my workspace to be in the Docuements folder for each user on my mac rather than within the Eclipse directory. I wished to do this as I often move up eclipse builds. To do this I edited the Info.plist file in the Eclipse application bundle and added a -data argument and for its value I gave it ~/Documents/Eclipse/workspace. If I type this into the terminal on the Mac this will take me to the currently logged in users home directory, and I would expect eclipse to create the workspace relative to the current logged in user, however it is appending the ECLIPSE_HOME on the front. If I set the data parameter to start with a / then the workspace is relative to the root, however ~ is treated as being relative to the ECLIPSE_HOME, whereas it should be treated as a shortform for the current users file space. Thanks Alasdair
Setting severity to enhancement. Tilde expansion is a unix shell feature.. what you see when you run from the command line is caused by the shell expanding the path before it is passed to eclipse. This isn't a universal convention, for example on Windows it is not recognized. One possible solution would be for the mac launcher to do the tilde expansion. Andre, what is this "Info.plist" file?
Created attachment 3723 [details] Eclipse's Info.plist file Info.plist is a (normally hidden) xml file within an application bundle that acts as the application's "manifest" (I've attached Eclipse's Info.plist file). Since MacOS X hides the command line from users, command line arguments for the Java VM and Eclipse can be specified in the Info.plist file as well. However, end users should not have to deal with the Info.plist file.
Whilst I would agree that the Info.plist is not usually visible to a user as there is no way to change the eclipse workspace using the GUI (see bug 32147) there will be times that it is necessary to edit this file. In a multi user environment the eclipse_home would not typically be writeable, and also individual users would want their own workspace, rather than sharing one. This necessitates editing the Info.plist so the current users workspace is used. On a Unix system the ~ would be expanded by the shell, however this is not happening on MacOS X, I think that it would be good if the mac launcher could expand the ~ if it appears. Alasdair
I think the following code in the Mac launcher would probably work. String workspaceLocation = "~/Documents/Eclipse/workspace"; if (workspaceLocation.startsWith("~")) { String userDir = System.getProperty("user.home"); String tmp = workspaceLocation.substring(1); workspaceLocation = userDir + tmp; } System.out.println(workspaceLocation);
*** Bug 33060 has been marked as a duplicate of this bug. ***
This can also be a problem for other Unix flavours where Eclipse is not launched from a shell, for example a KDE desktop icon. I think we should treat this as a general request for Tilde expansion in Eclipse when running on Unix-based platforms.
Thinking about the suggestion that eclipse should do the expansion, I think that would be nice as it would mean that on windows you could use ~ to direct that it goes relative to the My Documents folder in windows. Alasdair
Added '~' expansion to MacOS X launcher. Now you can write the following in Eclipse's Info.plist file: (Please note: arguments to Eclipse launcher are now specified via an new "Eclipse" array. The previously used "Java" properties are ignored.) <key>Eclipse</key> <array> <string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/ 1.3.1/Home/bin/java</string> <string>-consoleLog</string> <string>-showlocation</string> <string>-data</string><string>~/Documents/workspace</string> <string>-vmargs</string> <string>-Xms30M</string> <string>-Xmx150M</string> </array>