FS_Win32: Avoid an IOException on Windows if bash is not in PATH
Change-Id: I3145f74ecee9f5b368e7f4b9fd7cb906f407eff5 Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
a870a8a03c
commit
ec6ec3b10f
|
@ -111,18 +111,20 @@ protected File discoverGitPrefix() {
|
||||||
if (gitExe != null)
|
if (gitExe != null)
|
||||||
return resolveGrandparentFile(gitExe);
|
return resolveGrandparentFile(gitExe);
|
||||||
|
|
||||||
// This isn't likely to work, if bash is in $PATH, git should
|
if (searchPath(path, "bash.exe") != null) { //$NON-NLS-1$
|
||||||
// also be in $PATH. But its worth trying.
|
// This isn't likely to work, but its worth trying:
|
||||||
//
|
// If bash is in $PATH, git should also be in $PATH.
|
||||||
String w = readPipe(userHome(), //
|
String w = readPipe(userHome(),
|
||||||
new String[] { "bash", "--login", "-c", "which git" }, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
new String[] { "bash", "--login", "-c", "which git" }, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
Charset.defaultCharset().name());
|
Charset.defaultCharset().name());
|
||||||
if (w != null) {
|
if (w != null) {
|
||||||
// The path may be in cygwin/msys notation so resolve it right away
|
// The path may be in cygwin/msys notation so resolve it right away
|
||||||
gitExe = resolve(null, w);
|
gitExe = resolve(null, w);
|
||||||
if (gitExe != null)
|
if (gitExe != null)
|
||||||
return resolveGrandparentFile(gitExe);
|
return resolveGrandparentFile(gitExe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue