public static String naturalizeSlashes(FileSystem fileSystem, String path) { char rightSlash = CndFileUtils.getFileSeparatorChar(fileSystem); char wrongSlash = (rightSlash == '/') ? '\\' : '/'; return path.replace(wrongSlash, rightSlash); }
private String resolvePath(String filename) throws IllegalArgumentException { if (filename == null) { throw new NullPointerException("null filename passed to resolveFile"); // NOI18N } String result; if (RELATIVE_SLASH_SEPARATED_PATH.matcher(filename).matches()) { result = dir.getPath() + CndFileUtils.getFileSeparatorChar(fileSystem) + filename; } else { result = filename; } return FileSystemProvider.normalizeAbsolutePath(result, fileSystem); }
projectFolderField.setText(projectFolder + CndFileUtils.getFileSeparatorChar(fileSystem) + projectName); if (!validateProjectLocation()) { return;
FileObject file = fs.findResource(path); if (file != null && file.isFolder() && file.canRead()) { final char fileSeparatorChar = getFileSeparatorChar(fs); for (FileObject child : file.getChildren()) {
/** * finds file relatively to the baseFile * caller must check that resolved path is not the same as base file * to prevent recursive inclusions */ public static ResolvedPath resolveFilePath(FileSystem fs, String inclString, CharSequence baseFile) { if (baseFile != null) { String folder = CndPathUtilities.getDirName(baseFile.toString()); String absolutePath = folder + CndFileUtils.getFileSeparatorChar(fs) + inclString; if (isExistingFile(fs, absolutePath)) { absolutePath = normalize(fs, absolutePath); folder = normalize(fs, folder); return new ResolvedPath(fs, FilePathCache.getManager().getString(folder), absolutePath, true, 0); } } return null; }
if (accessor.isExistingDirectory(dirPrefix)) { FileSystem fs = dirPrefix.getFileSystem(); char fileSeparatorChar = CndFileUtils.getFileSeparatorChar(fs); String includedFile = anIncludedFile.replace('/', fileSeparatorChar); CharSequence prefix = dirPrefix.getAsSharedCharSequence();