當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtil.pathsEqual方法代碼示例

本文整理匯總了Java中com.intellij.openapi.util.io.FileUtil.pathsEqual方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.pathsEqual方法的具體用法?Java FileUtil.pathsEqual怎麽用?Java FileUtil.pathsEqual使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.util.io.FileUtil的用法示例。


在下文中一共展示了FileUtil.pathsEqual方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSameProject

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static boolean isSameProject(String path, @NotNull Project project) {
  IProjectStore projectStore = (IProjectStore)ServiceKt.getStateStore(project);

  String toOpen = FileUtil.toSystemIndependentName(path);
  String existing = projectStore.getProjectFilePath();

  String existingBaseDir = projectStore.getProjectBasePath();
  if (existingBaseDir == null) {
    // could be null if not yet initialized
    return false;
  }

  final File openFile = new File(toOpen);
  if (openFile.isDirectory()) {
    return FileUtil.pathsEqual(toOpen, existingBaseDir);
  }
  if (StorageScheme.DIRECTORY_BASED == projectStore.getStorageScheme()) {
    // todo: check if IPR is located not under the project base dir
    return FileUtil.pathsEqual(FileUtil.toSystemIndependentName(openFile.getParentFile().getPath()), existingBaseDir);
  }

  return FileUtil.pathsEqual(toOpen, existing);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ProjectUtil.java

示例2: addMapping

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@NotNull
public static List<VcsDirectoryMapping> addMapping(@NotNull List<VcsDirectoryMapping> existingMappings,
                                                   @NotNull String path,
                                                   @NotNull String vcs) {
  List<VcsDirectoryMapping> mappings = new ArrayList<VcsDirectoryMapping>(existingMappings);
  for (Iterator<VcsDirectoryMapping> iterator = mappings.iterator(); iterator.hasNext(); ) {
    VcsDirectoryMapping mapping = iterator.next();
    if (mapping.isDefaultMapping() && StringUtil.isEmptyOrSpaces(mapping.getVcs())) {
      LOG.debug("Removing <Project> -> <None> mapping");
      iterator.remove();
    }
    else if (FileUtil.pathsEqual(mapping.getDirectory(), path)) {
      if (!StringUtil.isEmptyOrSpaces(mapping.getVcs())) {
        LOG.warn("Substituting existing mapping [" + path + "] -> [" + mapping.getVcs() + "] with [" + vcs + "]");
      }
      else {
        LOG.debug("Removing [" + path + "] -> <None> mapping");
      }
      iterator.remove();
    }
  }
  mappings.add(new VcsDirectoryMapping(path, vcs));
  return mappings;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:VcsUtil.java

示例3: isExcludedFromCompilation

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public boolean isExcludedFromCompilation(@NotNull JpsModule module, @NotNull JpsModuleSourceRoot root) {
  final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);

  if (extension == null) {
    return false;
  }
  try {
    for (String genDir : AndroidJpsUtil.getGenDirs(extension)) {
      if (FileUtil.pathsEqual(genDir, root.getFile().getPath())) {
        return true;
      }
    }
  }
  catch (IOException e) {
    LOG.info(e);
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:AndroidExcludedJavaSourceRootProvider.java

示例4: writeFile

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public void writeFile(File inputFile, String jarPath) throws IOException {
  if (FileUtil.pathsEqual(inputFile.getPath(), myOutFilePath)) {
    throw new IOException("Cannot pack file " + myOutFilePath + " into itself");
  }
  super.writeFile(inputFile, jarPath);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:SafeSignedJarBuilder.java

示例5: isManagedFile

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public boolean isManagedFile(String path) {
  synchronized (myStateLock) {
    for (String each : myManagedFilesPaths) {
      if (FileUtil.pathsEqual(each, path)) return true;
    }
    return false;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:MavenProjectsTree.java

示例6: findByPath

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
private static Sdk findByPath(@NotNull SdkType sdkType, @NotNull Sdk[] sdks, @NotNull String sdkHome) {
  for (Sdk sdk : sdks) {
    final String path = sdk.getHomePath();
    if (sdk.getSdkType() == sdkType && path != null &&
        FileUtil.pathsEqual(FileUtil.toSystemIndependentName(path), FileUtil.toSystemIndependentName(sdkHome))) {
      return sdk;
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:SdkConfigurationUtil.java

示例7: setSdkHome

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public void setSdkHome(String sdkHome) {
  List<Sdk> sdkList = new ArrayList<Sdk>();
  sdkList.add(null);
  final List<Sdk> allSdks = PythonSdkType.getAllSdks();
  Collections.sort(allSdks, new PreferredSdkComparator());
  Sdk selection = null;
  for (Sdk sdk : allSdks) {
    String homePath = sdk.getHomePath();
    if (homePath != null && sdkHome != null && FileUtil.pathsEqual(homePath, sdkHome)) selection = sdk;
    sdkList.add(sdk);
  }

  myInterpreterComboBox.setModel(new CollectionComboBoxModel(sdkList, selection));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:PyPluginCommonOptionsForm.java

示例8: isPotentialProject

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public boolean isPotentialProject(String path) {
  if (isManagedFile(path)) return true;

  for (MavenProject each : getProjects()) {
    if (FileUtil.pathsEqual(path, each.getPath())) return true;
    if (each.getModulePaths().contains(path)) return true;
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:MavenProjectsTree.java

示例9: findSdkByPath

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
public static Sdk findSdkByPath(List<Sdk> sdkList, @Nullable String path) {
  if (path != null) {
    for (Sdk sdk : sdkList) {
      if (sdk != null && FileUtil.pathsEqual(path, sdk.getHomePath())) {
        return sdk;
      }
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:PythonSdkType.java

示例10: checkUnambiguousAndRecursiveArtifacts

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static boolean checkUnambiguousAndRecursiveArtifacts(CompileContext context, List<JpsArtifact> artifacts) {
  boolean success = true;

  for (JpsArtifact artifact : artifacts) {
    if (artifact.getArtifactType() instanceof AndroidApplicationArtifactType) {
      final List<JpsAndroidModuleExtension> facets = AndroidJpsUtil.getAllPackagedFacets(artifact);

      if (facets.size() > 1) {
        context.processMessage(new CompilerMessage(
          ANDROID_VALIDATOR, BuildMessage.Kind.ERROR, "Cannot build artifact '" + artifact.getName() +
                                                      "' because it contains more than one Android package"));
        success = false;
        continue;
      }
      final String artifactOutputPath = artifact.getOutputFilePath();

      if (artifactOutputPath != null && facets.size() > 0) {
        final JpsAndroidModuleExtension facet = facets.get(0);
        final String apkPath = AndroidFinalPackageElementBuilder.getApkPath(facet);

        if (FileUtil.pathsEqual(apkPath, artifactOutputPath)) {
          context.processMessage(new CompilerMessage(
            ANDROID_VALIDATOR, BuildMessage.Kind.ERROR,
            "Incorrect output path for artifact '" + artifact.getName() + "': " + FileUtil.toSystemDependentName(apkPath)));
          success = false;
        }
      }
    }
  }
  return success;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:AndroidSourceGeneratingBuilder.java

示例11: registerPathVariable

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static void registerPathVariable() {
  String repository = MavenUtil.resolveLocalRepository(null, null, null).getAbsolutePath();
  PathMacros macros = PathMacros.getInstance();

  for (String each : macros.getAllMacroNames()) {
    String path = macros.getValue(each);
    if (path != null && FileUtil.pathsEqual(repository, path)) {
      return;
    }
  }

  macros.setMacro(MAVEN_REPOSITORY, repository);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:MavenEnvironmentRegistrar.java

示例12: isRunningTarget

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public boolean isRunningTarget(AntBuildTarget target) {
  final VirtualFile vFile = target.getModel().getBuildFile().getVirtualFile();
  if (vFile == null) {
    return false;
  }
  if (myAntFileUrl == null || !FileUtil.pathsEqual(myAntFileUrl, vFile.getUrl())) {
    return false;
  }
  return Comparing.equal(myTargetName, target.getName());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:AntBeforeRunTask.java

示例13: isEqual

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public boolean isEqual(String val1, String val2) {
  return FileUtil.pathsEqual(val1, val2);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:PathStringDescriptor.java

示例14: isConfigurationFromContext

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public boolean isConfigurationFromContext(JarApplicationConfiguration configuration, ConfigurationContext context) {
  VirtualFile file = getJarFileFromContext(context);
  return file != null && FileUtil.pathsEqual(file.getPath(), configuration.getJarPath());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:JarApplicationConfigurationProducer.java

示例15: belongs

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public boolean belongs(String url) {
  if (myFile.isDirectory()){
    return FileUtil.startsWith(url, myUrl);
  }
  return FileUtil.pathsEqual(url, myUrl);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:OneProjectItemCompileScope.java


注:本文中的com.intellij.openapi.util.io.FileUtil.pathsEqual方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。