public FSPath(FileSystem fileSystem, String path) { this.fileSystem = fileSystem; this.path = CndFileUtils.normalizeAbsolutePath(fileSystem, path); }
private static String normalize(FileSystem fs, String path) { return CndFileUtils.normalizeAbsolutePath(fs, path); }
/** * normalize file * @param file * @return */ public static File normalizeFile(File file) { CndUtils.assertAbsoluteFileInConsole(file, "Is it OK to normalize not absolute file? [" + file + "] during this session it is [" + file.getAbsolutePath() + "] but will be different if start IDE from another folder"); //NOI18N String path = file.getPath(); String normPath = normalizeAbsolutePath(file.getAbsolutePath()); return path.equals(normPath) ? file : new File(normPath); }
private String getRightName(String fullName){ fullName = CndFileUtils.normalizeAbsolutePath(fullName); fullName = fixFileName(fullName); return fullName; }
public static void assertNormalized(FileSystem fs, CharSequence absPath) { if (isDebugMode()) { String normFile = CndFileUtils.normalizeAbsolutePath(fs, absPath.toString()); if (!normFile.contentEquals(absPath)) { assertTrueInConsole(false, "Parameter file was not normalized. Was " + absPath + " instead of " + normFile); // NOI18N } } }
private String getValidBinaryPath() { String path = ((EditableComboBox) binaryField).getText().trim(); if (path.isEmpty()) { return null; } if (CndPathUtilities.isPathAbsolute(path)) { return CndFileUtils.normalizeAbsolutePath(fileSystem, path); } else { return null; } }
protected String normalizePath(String path) { // this call also fixes inambiguties at case insensitive systems when work // with case sensitive "path"s returned by remote compilers return CndFileUtils.normalizeAbsolutePath(FileSystemProvider.getFileSystem(getExecutionEnvironment()), path); }
public static String toAbsolutePath(FileSystem fileSystem, String basePath, String path) { CndUtils.assertAbsolutePathInConsole(basePath); path = (path == null || path.length() == 0) ? "." : path; // NOI18N if (!isPathAbsolute(path)) { path = basePath + '/' + path; //NOI18N } path = CndFileUtils.normalizeAbsolutePath(fileSystem, path); path = naturalizeSlashes(fileSystem, path); return path; }
public static String normalizePath(FileObject fo) { try { return normalizeAbsolutePath(fo.getFileSystem(), fo.getPath()); } catch (FileStateInvalidException ex) { Exceptions.printStackTrace(ex); return fo.getPath(); } }
private boolean validSourceRoot() { String path = sourcesField.getText().trim(); if (path.isEmpty()) { return false; } if (CndPathUtilities.isPathAbsolute(path)) { FileObject fo = fileSystem.findResource(CndFileUtils.normalizeAbsolutePath(path)); if (fo == null || !fo.isValid()) { return false; } return fo.isFolder(); } else { return false; } }
public DefaultFileItem(NativeProject project, String absolutePath) { Parameters.notNull("project", project); Parameters.notNull("absolutePath", absolutePath); this.project = project; this.normalizedAbsPath = CndFileUtils.normalizeAbsolutePath(project.getFileSystem(), absolutePath); }
public static String normalizeAbsolutePath(String absPath, Project project) { ExecutionEnvironment execEnv = getProjectSourceExecutionEnvironment(project); if (execEnv != null && execEnv.isRemote()) { return normalizeAbsolutePath(absPath, execEnv); } else { return CndFileUtils.normalizeAbsolutePath(absPath); } }
private synchronized void init() { if (!inited && this.projectDescriptorProvider.gotDescriptor()) { MakeConfigurationDescriptor cd = this.projectDescriptorProvider.getConfigurationDescriptor(); if (cd != null) { Configurations confs = cd.getConfs(); Set<String> newSet = new HashSet<>(); for (Configuration conf : confs.getConfigurations()) { if (conf instanceof MakeConfiguration) { String outputValue = ((MakeConfiguration) conf).getOutputValue(); if (!outputValue.isEmpty()) { newSet.add(CndFileUtils.normalizeAbsolutePath(((MakeConfiguration) conf).getAbsoluteOutputValue())); } } } skippedFiles = newSet; inited = true; } } } }
/** * * @param projectName name of the project * @param projectFolder project folder (i.e. ~/NetbeansProjects/projectName) */ //XXX:fullRemote:fileSystem - change File to setFSPath public ProjectParameters(String projectName, FSPath projectFolder) { this.projectName = projectName; this.sourceEnv = FileSystemProvider.getExecutionEnvironment(projectFolder.getFileSystem()); this.projectFolderPath = CndFileUtils.normalizeAbsolutePath(projectFolder.getFileSystem(), projectFolder.getPath()); this.makefile = MakeConfigurationDescriptor.DEFAULT_PROJECT_MAKFILE_NAME; this.configurations = new MakeConfiguration[0]; this.openFlag = false; this.sourceFolders = null; this.sourceFoldersFilter = null; this.testFolders = null; this.importantFileItems = null; this.mainFile = ""; this.postCreationClassName = null; this.mainProject = null; this.templateParams = Collections.<String, Object>emptyMap(); }
public boolean showSource(SourceFileInfo lineInfo, boolean isReadOnly) { FileObject fo = CndFileUtils.toFileObject(CndFileUtils.normalizeAbsolutePath(lineInfo.getFileName())); try { new ROEditor(fo).open(); } catch (DataObjectNotFoundException e) { e.printStackTrace(); return false; } return true; }
public static FileObject getFileObject(String path, WizardDescriptor wizardDescriptor) { if (isFullRemote(wizardDescriptor)) { String hostUID = (String) wizardDescriptor.getProperty(WizardConstants.PROPERTY_HOST_UID); CndUtils.assertNotNull(hostUID, "Null host UID"); //NOI18N ExecutionEnvironment env = ExecutionEnvironmentFactory.fromUniqueID(hostUID); return RemoteFileUtil.getFileObject(path, env); } else { return CndFileUtils.toFileObject(CndFileUtils.normalizeAbsolutePath(path)); } }
exe = buildWorkingDirFO.getFileObject(executablePath); } else { executablePath = CndFileUtils.normalizeAbsolutePath(executablePath); exe = RemoteFileUtil.getFileObject( executablePath,
/** * 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; }
private CsmFile findFileByPath(CharSequence absolutePath, boolean createIfPossible) { absolutePath = CndFileUtils.normalizeAbsolutePath(fileSystem, absolutePath.toString()); APTPreprocHandler preprocHandler = null; if (getFileContainer().getEntry(absolutePath) == null) {
private void renameTo(String newPath) { Folder f = getFolder(); String oldPath; if (normalizedPath != null) { oldPath = normalizedPath; } else { oldPath = CndFileUtils.normalizeAbsolutePath(fileSystem, getAbsPath()); } Item item = f.addItem(new Item(fileSystem, newPath)); if (item != null && item.getFolder() != null) { if (item.getFolder().isProjectFiles()) { copyItemConfigurations(this, item); } f.removeItem(this); f.renameItemAction(oldPath, item); } }