Java Code Examples for com.intellij.util.PathUtil#getCanonicalPath()

The following examples show how to use com.intellij.util.PathUtil#getCanonicalPath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DirectorySection.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
protected DirectoryEntry parseItem(ProjectViewParser parser, ParseContext parseContext) {
  String text = parseContext.current().text;
  boolean excluded = text.startsWith("-");
  text = excluded ? text.substring(1) : text;

  // removes '.' path sections, traverses ".." without handling symlinks
  text = PathUtil.getCanonicalPath(text);

  String error = WorkspacePath.validate(text);
  if (error != null) {
    parseContext.addError(error);
    return null;
  }
  WorkspacePath directory = new WorkspacePath(text);
  return excluded ? DirectoryEntry.exclude(directory) : DirectoryEntry.include(directory);
}
 
Example 2
Source File: GeneratedAndroidResourcesSection.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected GenfilesPath parseItem(ProjectViewParser parser, ParseContext parseContext) {
  String canonicalPath = PathUtil.getCanonicalPath(parseContext.current().text);

  List<BlazeValidationError> errors = new ArrayList<>();
  if (!GenfilesPath.validate(canonicalPath, errors)) {
    parseContext.addErrors(errors);
    return null;
  }
  return new GenfilesPath(canonicalPath);
}
 
Example 3
Source File: MainMavenActionGroup.java    From MavenHelper with Apache License 2.0 5 votes vote down vote up
private void addRunConfigurations(List<AnAction> result, Project project, final MavenProjectInfo mavenProject) {
	final List<RunnerAndConfigurationSettings> configurationSettings = RunManager.getInstance(project).getConfigurationSettingsList(
		MavenRunConfigurationType.getInstance());

	String directory = PathUtil.getCanonicalPath(mavenProject.mavenProject.getDirectory());

	for (RunnerAndConfigurationSettings cfg : configurationSettings) {
		MavenRunConfiguration mavenRunConfiguration = (MavenRunConfiguration) cfg.getConfiguration();
		if (directory.equals(PathUtil.getCanonicalPath(mavenRunConfiguration.getRunnerParameters().getWorkingDirPath()))) {
			result.add(getRunConfigurationAction(project, cfg));
		}
	}
}
 
Example 4
Source File: ExternalSystemImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
protected static String getAbsolutePath(String path) {
  path = VfsUtilCore.urlToPath(path);
  path = PathUtil.getCanonicalPath(path);
  return FileUtil.toSystemIndependentName(path);
}
 
Example 5
Source File: MavenImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
private static String getAbsolutePath(String path) {
  path = VfsUtil.urlToPath(path);
  path = PathUtil.getCanonicalPath(path);
  return FileUtil.toSystemIndependentName(path);
}
 
Example 6
Source File: CompilerPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static File getCompilerSystemDirectory() {
  //noinspection HardCodedStringLiteral
  final String systemPath =
    ourSystemPath != null ? ourSystemPath : (ourSystemPath = PathUtil.getCanonicalPath(ContainerPathManager.get().getSystemPath()));
  return new File(systemPath, "compiler");
}