public static char getFileSeparatorChar(FileSystem fs) { if (isLocalFileSystem(fs)) { return File.separatorChar; } else { return '/'; //NOI18N } }
@Override public String toString(){ return "ResPath{" + path + " in " + folder + (CndFileUtils.isLocalFileSystem(fileSystem) ? "" : fileSystem) + "}"; // NOI18N } }
@Override public String getHtmlDisplayName() { if (CndFileUtils.isLocalFileSystem(fileSystem)) { return name.toString(); } else { return NbBundle.getMessage(getClass(), "ProjectHtmlDisplayName", name, fileSystem.getDisplayName()); } }
@Override public String toString() { return CndFileUtils.isLocalFileSystem(fileSystem) ? name.toString() : (fileSystem.getDisplayName() + ":" + name); // NOI18N } }
@Override public String getDisplayName() { if (CndFileUtils.isLocalFileSystem(fileSystem)) { return name.toString(); } else { return NbBundle.getMessage(getClass(), "ProjectDisplayName", name, fileSystem.getDisplayName()); } }
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 } }
@Override protected boolean addFileChangeListenerImpl(FileChangeListener listener, FileSystem fileSystem, String path) { for (CndFileSystemProvider provider : cache) { if (provider.addFileChangeListenerImpl(listener, fileSystem, path)) { return true; } } if (CndFileUtils.isLocalFileSystem(fileSystem)) { FileUtil.addFileChangeListener(listener, FileUtil.normalizeFile(new File(path))); return true; } else { return false; } }
@Override protected boolean removeFileChangeListenerImpl(FileChangeListener listener, FileSystem fileSystem, String path) { for (CndFileSystemProvider provider : cache) { if (provider.removeFileChangeListenerImpl(listener, fileSystem, path)) { return true; } } if (CndFileUtils.isLocalFileSystem(fileSystem)) { FileUtil.removeFileChangeListener(listener, FileUtil.normalizeFile(new File(path))); return true; } else { return false; } }
private static FileObject toFileObjectImpl(FileSystem fs, CharSequence absolutePath) { if (isLocalFileSystem(fs)) {
public static CharSequence getUniqueName(FileSystem fs, Object platformProject) { Parameters.notNull("FileSystem", fs); //NOI18N String postfix = CndFileUtils.isLocalFileSystem(fs) ? "" : fs.getDisplayName(); String result; if (platformProject instanceof NativeProject) { result = ((NativeProject) platformProject).getProjectRoot() + "/N/" + postfix; // NOI18N } else if (platformProject instanceof CharSequence) { result = ((CharSequence)platformProject).toString() + "/L/" + postfix; // NOI18N } else if (platformProject == null) { throw new IllegalArgumentException("Incorrect platform project: null"); // NOI18N } else { throw new IllegalArgumentException("Incorrect platform project class: " + platformProject.getClass()); // NOI18N } return ProjectNameCache.getManager().getString(result); }
if (!CndFileUtils.isLocalFileSystem(primaryFile.getFileSystem())) { return null;
private static Flags get(FileSystem fs, String absPath) { FileObject fo; if (isLocalFileSystem(fs)) { absPath = FileUtil.normalizePath(absPath); fo = CndFileSystemProvider.toFileObject(absPath); } else { fo = fs.findResource(absPath); } return get(fo); }
if (CndFileUtils.isLocalFileSystem(fileSystem)) {
if (CndFileUtils.isLocalFileSystem(projectDirectory)) { File cache = new File(projectDirectory.getPath() + "/nbproject/private/cache/model"); //NOI18N cache.mkdirs();
public void setBaseDir(String baseDir) { CndUtils.assertTrue(CndFileUtils.isLocalFileSystem(fsPath.getFileSystem()), "Setting baseDir for non-local configuration?!"); //NOI18N this.fsPath = new FSPath(fsPath.getFileSystem(), baseDir); }
@Override public RemoteSyncFactory getSyncFactory() { MakeConfiguration activeConfiguration = project.getActiveConfiguration(); if (activeConfiguration != null) { if (CndFileUtils.isLocalFileSystem(activeConfiguration.getBaseFSPath().getFileSystem())) { return activeConfiguration.getRemoteSyncFactory(); } else { return RemoteSyncFactory.fromID(RemoteProject.FULL_REMOTE_SYNC_ID); } } else { return null; } }
private static void index(FileSystem fs, String path, ConcurrentMap<String, Flags> files) { if (isLocalFileSystem(fs)) { File file = new File(path); if (CndFileSystemProvider.canRead(path)) {
try { FileSystem fs = dObj.getPrimaryFile().getFileSystem(); if (!CndFileUtils.isLocalFileSystem(fs)) { annotationAttrs.add(new AttrValuePair(ATTR_ANNOTATION_FS, CndFileUtils.fileObjectToUrl(fs.getRoot()).toString()));
FileObject fo = dao.getPrimaryFile(); boolean resetLS = true; if (CndFileUtils.isLocalFileSystem(fo.getFileSystem())) { resetLS = false; } else {
/** * In many places, standard sequence is as follows: * - convert path to absolute if need * - normalize it * - find file object * In the case of non-local file systems we should delegate it to correspondent file systems. */ public static FileObject getFileObject(FileObject baseFileObject, String relativeOrAbsolutePath) { FileObject result = FileSystemProvider.getFileObject(baseFileObject, relativeOrAbsolutePath); if (result == null) { String absRootPath = CndPathUtilities.toAbsolutePath(baseFileObject, relativeOrAbsolutePath); try { // XXX:fullRemote we use old logic for local and new for remote // but remote approach for local gives #197093 - Exception: null file final FileSystem fs = baseFileObject.getFileSystem(); if (CndFileUtils.isLocalFileSystem(fs)) { result = CndFileUtils.toFileObject(CndFileUtils.normalizeAbsolutePath(absRootPath)); } else { result = InvalidFileObjectSupport.getInvalidFileObject(fs, absRootPath); } } catch (FileStateInvalidException ex) { Exceptions.printStackTrace(ex); result = InvalidFileObjectSupport.getInvalidFileObject(InvalidFileObjectSupport.getDummyFileSystem(), absRootPath); } } return result; }