@@ -1022,8 +1022,7 @@ public class DirCacheCheckout { | |||
} | |||
private static boolean isValidPathSegment(CanonicalTreeParser t) { | |||
String osName = SystemReader.getInstance().getProperty("os.name"); | |||
boolean isWindows = "Windows".equals(osName); | |||
boolean isWindows = SystemReader.getInstance().isWindows(); | |||
boolean isOSX = SystemReader.getInstance().isMacOS(); | |||
boolean ignCase = isOSX || isWindows; | |||
@@ -724,8 +724,7 @@ public class DirCacheEntry { | |||
case ':': | |||
// Tree's never have a backslash in them, not even on Windows | |||
// but even there we regard it as an invalid path | |||
if ("Windows".equals(SystemReader.getInstance().getProperty( | |||
"os.name"))) | |||
if (SystemReader.getInstance().isWindows()) | |||
return false; | |||
//$FALL-THROUGH$ | |||
default: |
@@ -89,7 +89,7 @@ public abstract class FS { | |||
* @return detected file system abstraction | |||
*/ | |||
public static FS detect(Boolean cygwinUsed) { | |||
if (FS_Win32.isWin32()) { | |||
if (SystemReader.getInstance().isWindows()) { | |||
if (cygwinUsed == null) | |||
cygwinUsed = Boolean.valueOf(FS_Win32_Cygwin.isCygwin()); | |||
if (cygwinUsed.booleanValue()) |
@@ -46,25 +46,11 @@ package org.eclipse.jgit.util; | |||
import java.io.File; | |||
import java.nio.charset.Charset; | |||
import java.security.AccessController; | |||
import java.security.PrivilegedAction; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
class FS_Win32 extends FS { | |||
static boolean isWin32() { | |||
final String osDotName = AccessController | |||
.doPrivileged(new PrivilegedAction<String>() { | |||
public String run() { | |||
return System.getProperty("os.name"); | |||
} | |||
}); | |||
return osDotName != null | |||
&& StringUtils.toLowerCase(osDotName).indexOf("windows") != -1; | |||
} | |||
FS_Win32() { | |||
super(); | |||
} |
@@ -239,6 +239,19 @@ public abstract class SystemReader { | |||
return DateFormat.getDateTimeInstance(dateStyle, timeStyle); | |||
} | |||
/** | |||
* @return true if we are running on a Windows. | |||
*/ | |||
public boolean isWindows() { | |||
String osDotName = AccessController | |||
.doPrivileged(new PrivilegedAction<String>() { | |||
public String run() { | |||
return getProperty("os.name"); | |||
} | |||
}); | |||
return osDotName.startsWith("Windows"); | |||
} | |||
/** | |||
* @return true if we are running on Mac OS X | |||
*/ |