static File resolveFile(File directory, String subpath) { subpath = subpath.trim(); if (subpath.startsWith("/")) { // NOI18N subpath = subpath.substring(1); } return PropertyUtils.resolveFile(directory, subpath); }
/** * @return absolute file path (possibly resolved to the given base folder) */ public String getAbsoluteFilePath(FileObject baseFolder) { File file = new File(filePath); if (file.isAbsolute()) { return file.getAbsolutePath(); } return PropertyUtils.resolveFile(FileUtil.toFile(baseFolder), filePath).getAbsolutePath(); }
private List<PathResourceImplementation> getPath() { List<PathResourceImplementation> result = new ArrayList<>(); for (String p : propertyNames) { String prop = evaluator.getProperty(p); if (prop != null) { for (String piece : PropertyUtils.tokenizePath(prop)) { File f = PropertyUtils.resolveFile(projectFolder, piece); URL entry = FileUtil.urlForArchiveOrDir(f); if (entry != null) { result.add(ClassPathSupport.createResource(entry)); } else { Logger.getLogger(ProjectClassPathImplementation.class.getName()).log(Level.WARNING, "{0} does not look like a valid archive file", f); } } } } return Collections.unmodifiableList(result); } }
File libLoc = PropertyUtils.resolveFile(projectLoc, location); if (!CollocationQuery.areCollocated(projectLoc, libLoc)) { settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == project && libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) { //do not update the relative path if within the project.. libraryWithinProject = true; FileObject fo = FileUtil.toFileObject(libraryFile); if (new File(libraryPath).isAbsolute() && fo != null) { // if absolte path within project, it will get moved/copied.. absolutesRelPath = FileUtil.getRelativePath(project.getProjectDirectory(), fo); } } } }
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == project && libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) { //do not update the relative path if within the project.. libraryWithinProject = true; FileObject fo = FileUtil.toFileObject(libraryFile); if (new File(libraryPath).isAbsolute() && fo != null) { // if absolte path within project, it will get moved/copied.. absolutesRelPath = FileUtil.getRelativePath(project.getProjectDirectory(), fo); } } } }
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == project && libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) { //do not update the relative path if within the project.. libraryWithinProject = true; FileObject fo = FileUtil.toFileObject(libraryFile); if (new File(libraryPath).isAbsolute() && fo != null) { // if absolte path within project, it will get moved/copied.. absolutesRelPath = FileUtil.getRelativePath(project.getProjectDirectory(), fo); } } } }
public void store() throws IOException { Preferences prefs = prefs(suiteProject); prefs.putBoolean(GENERATE_FOR_WINDOWS, windowsModel.isSelected()); prefs.putBoolean(GENERATE_FOR_LINUX, linuxModel.isSelected()); prefs.putBoolean(GENERATE_FOR_SOLARIS, solarisModel.isSelected()); prefs.putBoolean(GENERATE_FOR_MAC, macModel.isSelected()); prefs.putBoolean(USE_PACK200_COMPRESSION, pack200Model.isSelected()); String licenseName = (String) licenseModel.getSelectedItem(); if (licenseName != null) { int index = licenseModel.getNames().indexOf(licenseName); if (index != -1) { String type = licenseModel.getTypes().get(index); if (type.equals(LICENSE_TYPE_FILE)) { File suiteLocation = FileUtil.toFile(suiteProject.getProjectDirectory()); File f = PropertyUtils.resolveFile(suiteLocation, licenseName); String rel = PropertyUtils.relativizeFile(suiteLocation, f); if (rel != null) { prefs.put(LICENSE_FILE, rel); } else { prefs.put(LICENSE_FILE, f.getAbsolutePath()); } prefs.remove(LICENSE_TYPE); } else { prefs.put(LICENSE_TYPE, type); prefs.remove(LICENSE_FILE); } } } }
@CheckForNull public File getResolvedWebRootFolder() { File sourceDir = resolveFile(getSrcDir()); if (sourceDir == null) { return null; } String wr = getWebRoot(); if (StringUtils.hasText(wr)) { return PropertyUtils.resolveFile(sourceDir, wr); } return sourceDir; }
@CheckForNull static File resolveTarget(File root, List<Pair<String, String>> mappings, File file, String name) { for (Pair<String, String> mapping : mappings) { File from = resolveFile(root, mapping.first()); String relpath; try { relpath = PropertyUtils.relativizeFile(from, file.getParentFile()); } catch (IllegalArgumentException ex) { // #237525 LOGGER.log(Level.INFO, "Incorrect mapping [existing file set]", ex); return null; } if (relpath != null && !relpath.startsWith("..")) { // NOI18N // path match File to = resolveFile(root, mapping.second()); to = PropertyUtils.resolveFile(to, relpath); return resolveFile(to, makeCssFilename(name)); } } // no mapping return null; }
public static File getSubdirectory(PhpProject project, FileObject rootDirectory, String subdirectoryPath) { File rootDir = FileUtil.toFile(rootDirectory); if (!StringUtils.hasText(subdirectoryPath)) { return rootDir; } // first try to resolve fileobject FileObject fo = rootDirectory.getFileObject(subdirectoryPath); if (fo != null) { return FileUtil.toFile(fo); } // fallback for OS specific paths (should be changed everywhere, my fault, sorry) return PropertyUtils.resolveFile(FileUtil.toFile(rootDirectory), subdirectoryPath); }
try { File base = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); File location = FileUtil.normalizeFile(PropertyUtils.resolveFile(base, loc)); URL url = location.toURI().toURL(); man = LibraryManager.forLocation(url);
try { File base = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); File location = FileUtil.normalizeFile(PropertyUtils.resolveFile(base, loc)); URL url = location.toURI().toURL(); man = LibraryManager.forLocation(url);
try { File base = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); File location = FileUtil.normalizeFile(PropertyUtils.resolveFile(base, loc)); URL url = location.toURI().toURL(); man = LibraryManager.forLocation(url);
project.getAntProjectHelper().setLibrariesLocation(PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), original.absolutesRelPath).getAbsolutePath());
project.getAntProjectHelper().setLibrariesLocation(PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), original.absolutesRelPath).getAbsolutePath());
public static void initializeProject(@NonNull ClientSideProject project, @NonNull String siteRoot, @NullAllowed String test) throws IOException { File projectDirectory = FileUtil.toFile(project.getProjectDirectory()); assert projectDirectory != null; assert projectDirectory.isDirectory(); // ensure directories exists ensureDirectoryExists(PropertyUtils.resolveFile(projectDirectory, siteRoot)); if (test != null) { ensureDirectoryExists(PropertyUtils.resolveFile(projectDirectory, test)); } // save project ClientSideProjectProperties projectProperties = new ClientSideProjectProperties(project); projectProperties.setSiteRootFolder(siteRoot); projectProperties.setTestFolder(test); projectProperties.setSelectedBrowser(project.getProjectWebBrowser().getId()); projectProperties.save(); }
project.getAntProjectHelper().setLibrariesLocation(PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), original.absolutesRelPath).getAbsolutePath());
@NbBundle.Messages({ "ProjectUtilities_FailedCreateOutputFolderMsg=Failed to create build output folder: {0}" }) public static FileObject getOrCreateBuildFolder(Project project, String buildDirProp) { FileObject buildDir = FileUtil.toFileObject(PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), buildDirProp)); if (buildDir == null) { try { // TODO: if buildDirProp is absolute, relativize via PropertyUtils buildDir = FileUtil.createFolder(project.getProjectDirectory(), buildDirProp); } catch (IOException e) { Bundle.ProjectUtilities_FailedCreateOutputFolderMsg(e.getMessage()); ErrorManager.getDefault().notify(ErrorManager.ERROR, e); return null; } } return buildDir; }
@Messages({ "WARN_MakeSharable.absolutePath=<html>Please make sure that the absolute path in the Libraries Folder field is valid for all users.<html>", "WARN_makeSharable.relativePath=<html>Please make sure that the relative path in the Libraries Folder field is valid for all users.<html>" }) boolean isValidPanel() { String location = getLibraryLocation(); boolean wrong = false; if (new File(location).isAbsolute()) { settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, WARN_MakeSharable_absolutePath()); wrong = true; } else { File projectLoc = FileUtil.toFile(helper.getProjectDirectory()); File libLoc = PropertyUtils.resolveFile(projectLoc, location); if (!CollocationQuery.areCollocated(projectLoc, libLoc)) { settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, WARN_makeSharable_relativePath()); wrong = true; } } if (!wrong) { settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null); } return true; }