Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 33148 - setting workspace to be relative to ~ doesn't work
Summary: setting workspace to be relative to ~ doesn't work
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: 3.0   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 33060 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-25 17:04 EST by Alasdair Nottingham CLA
Modified: 2003-05-26 14:54 EDT (History)
2 users (show)

See Also:


Attachments
Eclipse's Info.plist file (1.43 KB, text/plain)
2003-02-26 12:22 EST, Andre Weinand CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alasdair Nottingham CLA 2003-02-25 17:04:29 EST
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
Comment 1 John Arthorne CLA 2003-02-26 11:52:28 EST
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?
Comment 2 Andre Weinand CLA 2003-02-26 12:22:15 EST
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.
Comment 3 Alasdair Nottingham CLA 2003-02-26 15:32:52 EST
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
Comment 4 Alasdair Nottingham CLA 2003-02-26 18:23:39 EST
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);
Comment 5 John Arthorne CLA 2003-02-28 10:47:04 EST
*** Bug 33060 has been marked as a duplicate of this bug. ***
Comment 6 John Arthorne CLA 2003-02-28 10:50:06 EST
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.
Comment 7 Alasdair Nottingham CLA 2003-02-28 11:34:01 EST
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
Comment 8 Andre Weinand CLA 2003-04-21 16:28:57 EDT
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>