public static Set<String> createExtensionSet() { if (CndFileUtils.isSystemCaseSensitive()) { return new TreeSet<>(); } else { return new TreeSet<>(String.CASE_INSENSITIVE_ORDER); } }
protected boolean areFilenamesEqual(String firstFile, String secondFile) { return CndFileUtils.isSystemCaseSensitive() ? firstFile.equals(secondFile) : firstFile.equalsIgnoreCase(secondFile); } }
public static boolean areFilenamesEqual(String firstFile, String secondFile) { return isSystemCaseSensitive() ? firstFile.equals(secondFile) : firstFile.equalsIgnoreCase(secondFile); }
private static String changeStringCaseIfNeeded(FileSystem fs, String path) { if (isLocalFileSystem(fs)) { if (CndFileUtils.isSystemCaseSensitive()) { return path; } else { return path.toLowerCase(); } } else { return path; // remote is always case sensitive } }
/** * normalize LOCAL absolute paths * @param path * @return */ public static String normalizeAbsolutePath(String path) { CndUtils.assertAbsolutePathInConsole(path, "path for normalization must be absolute"); //NOI18N // TODO: this should be probably rewritten in a more elegant way if (path.startsWith("/") && Utilities.isWindows()) { // NOI18N return PathUtilities.normalizeUnixPath(path); } boolean caseSensitive = isSystemCaseSensitive(); if (!caseSensitive) { if (Utilities.isWindows()) { path = path.replace('\\', '/'); } } String normalized; // small optimization for true case sensitive OSs if (!caseSensitive || (path.endsWith("/.") || path.endsWith("\\.") || path.contains("..") || path.contains("./") || path.contains(".\\"))) { // NOI18N normalized = FileUtil.normalizeFile(new File(path)).getAbsolutePath(); } else { normalized = path; } return normalized; }