}
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;
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:
* @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())
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();
}
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
*/