Locate $HOME like C Git does on Windows

Java's user.home is not the same as $HOME so EGit did see the
same global configuration as C Git does.

Bug: 333269
Change-Id: Id54fc5292bf8c5a67177f9097ee692717a7df336
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
This commit is contained in:
Robin Rosenberg 2011-01-12 14:58:55 +01:00
parent be38185a03
commit 0fd9676771
1 changed files with 18 additions and 0 deletions

View File

@ -96,4 +96,22 @@ public File gitPrefix() {
return null;
}
@Override
protected File userHomeImpl() {
String home = SystemReader.getInstance().getenv("HOME");
if (home != null)
return resolve(null, home);
String homeDrive = SystemReader.getInstance().getenv("HOMEDRIVE");
if (homeDrive != null) {
String homePath = SystemReader.getInstance().getenv("HOMEPATH");
return new File(homeDrive, homePath);
}
String homeShare = SystemReader.getInstance().getenv("HOMESHARE");
if (homeShare != null)
return new File(homeShare);
return super.userHomeImpl();
}
}