@Test public void testWindowsPaths() { if (File.separatorChar != '\\') return; if (Boolean.getBoolean("java.awt.headless")) return; final String[] trueStrings = new String[] { "C:\\monkey", "C:/monkey", "C:/", "C:\\" }; final String[] falseStrings = new String[] { "C:", "foo/bar", "/tmp/blah", "", "/", "blah:baz" }; for (final String trueString : trueStrings) { assertTrue(trueString, StringUtils.isLocalWindowsPath(trueString)); } for (final String falseString : falseStrings) { assertFalse(falseString, StringUtils.isLocalWindowsPath(falseString)); } }
public static boolean isLocalWindowsPath(final String path) { if (File.separatorChar != '\\') return false; if (path.length() < 3) return false; final char colon = path.charAt(1); final char slash = path.charAt(2); if (colon != ':') return false; if (slash != '\\' && slash != '/') return false; final String drive = path.substring(0, 3); if (s_headless) { return s_windowsDrive.matcher(drive).matches(); } else { final File file = new File(drive); return FileSystemView.getFileSystemView().isFileSystemRoot(file); } }
StringUtils { public static boolean isLocalWindowsPath(final String path) { if (File.separatorChar != '\\') return false; if (path.length() < 3) return false; final char colon = path.charAt(1); final char slash = path.charAt(2); if (colon != ':') return false; if (slash != '\\' && slash != '/') return false; final String drive = path.substring(0, 3); if (s_headless) { return s_windowsDrive.matcher(drive).matches(); } else { final File file = new File(drive); return FileSystemView.getFileSystemView().isFileSystemRoot(file); } } }
StringUtils { public static boolean isLocalWindowsPath(final String path) { if (File.separatorChar != '\\') return false; if (path.length() < 3) return false; final char colon = path.charAt(1); final char slash = path.charAt(2); if (colon != ':') return false; if (slash != '\\' && slash != '/') return false; final String drive = path.substring(0, 3); if (s_headless) { return s_windowsDrive.matcher(drive).matches(); } else { final File file = new File(drive); return FileSystemView.getFileSystemView().isFileSystemRoot(file); } }  }
StringUtils { public static boolean isLocalWindowsPath(final String path) { if (File.separatorChar != '\\') return false; if (path.length() < 3) return false; final char colon = path.charAt(1); final char slash = path.charAt(2); if (colon != ':') return false; if (slash != '\\' && slash != '/') return false; final String drive = path.substring(0, 3); if (s_headless) { return s_windowsDrive.matcher(drive).matches(); } else { final File file = new File(drive); return FileSystemView.getFileSystemView().isFileSystemRoot(file); } }  static String[] createCommandArray(String s, char delim); static String truncate(String name, int length); static boolean isLocalWindowsPath(final String path); static String prettyXml(String xml); }
StringUtils { public static boolean isLocalWindowsPath(final String path) { if (File.separatorChar != '\\') return false; if (path.length() < 3) return false; final char colon = path.charAt(1); final char slash = path.charAt(2); if (colon != ':') return false; if (slash != '\\' && slash != '/') return false; final String drive = path.substring(0, 3); if (s_headless) { return s_windowsDrive.matcher(drive).matches(); } else { final File file = new File(drive); return FileSystemView.getFileSystemView().isFileSystemRoot(file); } }  static String[] createCommandArray(String s, char delim); static String truncate(String name, int length); static boolean isLocalWindowsPath(final String path); static String prettyXml(String xml);  }