narek-utc / workspacemechanic

Automatically exported from code.google.com/p/workspacemechanic
0 stars 0 forks source link

User home directory not resolved on Windows #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install Workspace Mechanic in Eclipse on Windows.
2. Restart Eclipse
3a. Open the plugin's Preferences page; it contains an entry /.eclipse/mechanic
3b. Look at Eclipse logging; it has an entry !MESSAGE Directory 
'\.eclipse\mechanic' does not exist.

What is the expected output? What do you see instead?
I'd expect to see my home directory resolved, now it resolves to an empty 
string creating an non-existant path.

What version of the product are you using? On what operating system?
Eclipse 3.6, WSM 0.0.3, Windows 7

Please provide any additional information below.

IMHO the easiest way to fix this is by changing the UserHomeVariableInitializer 
class. Just change the initialize method to contain this:
    variable.setValue(System.getProperty("user.home"));

This should be platform-independent and also allow the user to override the 
setting from his eclipse.ini.

Original issue reported on code.google.com by albert.t...@gmail.com on 1 Mar 2011 at 12:54

GoogleCodeExporter commented 9 years ago
It seems this problem was also passingly mentioned in issue #34 but it got no 
comments.

I kept the default directory list as ${user_homedir}/.eclipse/mechanic, but the 
user_homedir variable is resolved to an empty string. This makes the path point 
to e.g. c:\.eclipse\mechanic, which doesn't exist. (Hence the entry in the logs)

I worked around this issue for now by setting an environment variable "HOME" to 
"%USERPROFILE%". See issue for a proposed fix.

Original comment by albert.t...@gmail.com on 4 Mar 2011 at 3:32

GoogleCodeExporter commented 9 years ago
Issue 34 has been merged into this issue.

Original comment by konigsb...@gmail.com on 6 Mar 2011 at 9:18

GoogleCodeExporter commented 9 years ago
Albert, it does look like that's the solution. I agree. I was about to ask you 
to verify this for me.

Do you think that having the paths separated by backslashes rather than forward 
slashes will be a problem? (At least any that you can see?

Original comment by konigsb...@gmail.com on 6 Mar 2011 at 9:34

GoogleCodeExporter commented 9 years ago
Should be fixed in head. please reopen as is required.

Original comment by konigsb...@gmail.com on 6 Mar 2011 at 9:39

GoogleCodeExporter commented 9 years ago
I don't understand your question there...

As said in comment 1, I made a variable HOME to %USERPROFILE%. The resolved 
path was something like "C:\Users\johndoe/.eclipse/mechanic" which has both 
backslashes and regular slashes. Now Eclipse seemed to understand that Windows 
only knows about backslashes and translated any slashes to backslashes, so it 
works just fine.

At any rate, I would keep the default setting as it is (using slashes) to make 
it work out of the box on Linux as well as on Windows.

Original comment by albert.t...@gmail.com on 6 Mar 2011 at 9:59

GoogleCodeExporter commented 9 years ago
You don't have to understand my question, I understand your response. I fixed 
it according to your suggestion (which I arrived at independently as well, so, 
that's good.)

Original comment by konigsb...@gmail.com on 6 Mar 2011 at 10:28

GoogleCodeExporter commented 9 years ago

Original comment by konigsb...@gmail.com on 11 Mar 2011 at 7:32