Bug 169385 - [WorkbenchLauncher] Using ~ in the workspace selector dialog no longer refers to home directory
Summary: [WorkbenchLauncher] Using ~ in the workspace selector dialog no longer refers...
Status: CLOSED DUPLICATE of bug 72607
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Prakash Rangaraj CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-01-02 18:39 EST by Alex Blewitt CLA
Modified: 2013-09-20 15:47 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Blewitt CLA 2007-01-02 18:39:55 EST
In Eclipse 3.2, I've been able to specify a workspace as local to my home directory by prefixing it with ~, so when starting, I have been able to select ~/Documents/SomeOtherWorkspace and it resolves to /Users/alex/Documents/SomeOtherWorkspace.

However, in Eclipse 3.3M4, if I type the same thing in, it gets resolved to /Path/To/Eclipse.app/Contents/MacOS/~/Documents/SomeOtherWorkspace, in other words, as a relative directory to the currently executing eclipse executable (which is located in the Contents/MacOS subdirectory).

If I start it with eclipse -data ~/Documents/SomeOtherWorkspace it seems to work as expected, and correctly resolves to the /Users/alex/Documents/SomeOtherWorkspace prefix. Is something being done to mangle the URL if it's not absolute or something? Has it changed recently if that's the case?
Comment 1 DJ Houghton CLA 2007-01-03 06:05:05 EST
Is there special processing of the text field before being passed to the runtime?
Comment 2 Kim Horne CLA 2007-01-03 09:57:43 EST
I think this may be a VM issue.  I just tried on 3.2.1 and I'm getting the same results.  Stepping through the code, if I have a file created with the String "~/workspace", getAbsolutePath() returns "/Applications/Eclipse 3.3 I20061214-14XX/Eclipse.app/Contents/MacOS/~/workspace"  I get this result whether or not I use 1.4.2 or 1.5.  Can you confirm that there is a version combination where the desired behavior occurs?
Comment 3 John Arthorne CLA 2007-01-03 10:20:43 EST
Tilde expansion is a Unix shell feature, not a general feature in the OS filesystem calls or in java.io.  Andre hacked tilde expansion in the Mac launcher (bug 33148), so perhaps something has gone wrong with that code. Andrew's launcher work is one possible culprit.
Comment 4 Kim Horne CLA 2007-01-03 10:50:22 EST
That was hacked into the launcher?  Looking at the code path I dont see a way that the launcher could've made this work... 
Comment 5 John Arthorne CLA 2007-01-03 12:08:27 EST
See the function expandShell in eclipseCarbon.c
Comment 6 Kim Horne CLA 2007-01-03 13:40:09 EST
That looks like it handles tilde expansion for command line arguments but this bug is about expanding them in the launcher dialog.  According to the original text the -data expansion works but the expansion in the dialog does not.  Looking at the code I'm not sure how it ever did.
Comment 7 John Arthorne CLA 2007-01-03 14:05:38 EST
Sorry, I was confused by comment #0 mentioning expansion when using the -data command line argument. I also don't know how this would have worked in the past, unless someone hacked it into the workspace selection dialog. I'll be quiet now.
Comment 8 Kim Horne CLA 2007-01-03 14:44:23 EST
I think we could replicate this behavior in the selection dialog.  we have access to $user.home ...
Comment 9 John Arthorne CLA 2007-01-03 16:06:54 EST
It seems like a losing game to get into, in general.  There are lots of places where file system paths are supplied by the user in the UI, and performing tilde expansion in only some of them would be inconsistent. I suspect we'd find all sorts of corner cases and inconsistencies trying to mimic this shell behaviour ourselves (consider ~username expansion, and the fact that tilde is a valid character in a unix path).

Alex, can you confirm that you believe tilde expansion was working at some point in the workspace selection dialog (as opposed to expansion of the -data command line argument)?
Comment 10 Alex Blewitt CLA 2007-01-03 18:47:00 EST
I was relatively sure that this worked in the past. But, if Kim was unable to replicate it on 3.2.1, I may have been wrong. (In which case, closing this as INVALID might be applicable.)

Note that it's not only the shell that does the expansion (but it does in this case) -- Finder.app allows you 'go to' folder ~ and other apps may also support it. I also think that if you use the ~ in the Info.plist (e.g. for the keyring) then it might be expected that the user be able to use ~ in the workspace selection dialog as well.

I've dropped this level to an 'enhancement' if it can be addressed. Whilst there's obviously workarounds, I don't believe that using workspaces buried inside the Eclipse.app/Contents/MacOS is a sensible plan for Macs under any circumstances; an app is usually uninstalled by dragging the Eclipse.app into the trash, and if a user has unwittingly entered ~/Documents as the workspace when it launches, they'll trash their entire workspace too.

I agree with John's point that chasing the ~ will be found in potentially many places; but the workspace selection dialog is probably one of the more important ones.
Comment 11 Eclipse Webmaster CLA 2007-07-29 09:21:23 EDT
Changing OS from Mac OS to Mac OS X as per bug 185991
Comment 12 Boris Bokowski CLA 2009-11-26 16:33:33 EST
Prakash is now responsible for watching bugs in the [WorkbenchLauncher] component area.
Comment 13 Alex Blewitt CLA 2010-04-28 19:27:16 EDT
Looks like this might be a dupe of bug 72607, provided that the platform is set to 'all' as it applies cross-unices (and the version number updated, of course)
Comment 14 Paul Webster CLA 2013-09-20 15:47:32 EDT

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