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


Java FileUtil.filesEqual方法代碼示例

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


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

示例1: cleanupBrokenData

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private void cleanupBrokenData() {
  close(true);

  //noinspection TestOnlyProblems
  final File currentDataDir = getCurrentDataDir();
  final File currentDataContextDir = getCurrentDataContextDir();
  final File[] files = currentDataDir.listFiles();
  if (files != null) {
    for (File file : files) {
      if (!FileUtil.filesEqual(file, currentDataContextDir)) {
        FileUtil.delete(file);
      }
    }
  }
  else {
    FileUtil.delete(currentDataDir);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:MavenIndex.java

示例2: consume

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public void consume(final Status status) throws SVNException {
  checkCanceled();
  final File ioFile = status.getFile();
  checkIfCopyRootWasReported(status);

  VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioFile);
  if (vFile != null && isIgnoredByVcs(vFile)) return;
  if (myProject.isDisposed()) throw new ProcessCanceledException();

  if (vFile != null && status.is(StatusType.STATUS_UNVERSIONED)) {
    if (vFile.isDirectory()) {
      if (!FileUtil.filesEqual(myCurrentItem.getPath().getIOFile(), ioFile)) {
        myQueue.add(createItem(VcsUtil.getFilePath(vFile), Depth.INFINITY, true));
      }
    }
    else {
      myReceiver.processUnversioned(vFile);
    }
  }
  else {
    myReceiver.process(VcsUtil.getFilePath(ioFile, status.getKind().isDirectory()), status);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:SvnRecursiveStatusWalker.java

示例3: copy

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public void copy(@NotNull File src, @NotNull File dst, boolean makeParents, boolean isMove) throws VcsException {
  List<String> parameters = new ArrayList<String>();

  CommandUtil.put(parameters, src);
  CommandUtil.put(parameters, dst, false);
  CommandUtil.put(parameters, makeParents, "--parents");

  // for now parsing of the output is not required as command is executed only for one file
  // and will be either successful or exception will be thrown
  // Use idea home directory for directory renames which differ only by character case on case insensitive file systems - otherwise that
  // directory being renamed will be blocked by svn process
  File workingDirectory =
    isMove && !SystemInfo.isFileSystemCaseSensitive && FileUtil.filesEqual(src, dst) ? CommandUtil.getHomeDirectory() : null;
  execute(myVcs, SvnTarget.fromFile(dst), workingDirectory, getCommandName(isMove), parameters, null);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:CmdCopyMoveClient.java

示例4: perform

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@NotNull
@Override
protected File perform(@NotNull ProgressIndicator indicator, @NotNull File destination) throws WizardException {
  indicator.setText("Installing Android SDK");
  try {
    FileUtil.ensureExists(destination);
    if (!FileUtil.filesEqual(destination.getCanonicalFile(), myRepo.getCanonicalFile())) {
      SdkMerger.mergeSdks(myRepo, destination, indicator);
      myRepoWasMerged = true;
    }
    myContext.print(String.format("Android SDK was installed to %1$s\n", destination), ConsoleViewContentType.SYSTEM_OUTPUT);
    return destination;
  }
  catch (IOException e) {
    throw new WizardException(e.getMessage(), e);
  }
  finally {
    indicator.stop();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:InstallComponentsPath.java

示例5: containsFile

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
/**
 * Returns true iff this SourceProvider provides the source folder that contains the given file.
 */
public static boolean containsFile(@NotNull SourceProvider provider, @NotNull File file) {
  Collection<File> srcDirectories = getAllSourceFolders(provider);
  if (FileUtil.filesEqual(provider.getManifestFile(), file)) {
    return true;
  }

  for (File container : srcDirectories) {
    // Check the flavor root directories
    File parent = container.getParentFile();
    if (parent != null && parent.isDirectory() && FileUtil.filesEqual(parent, file)) {
      return true;
    }

    // Don't do ancestry checking if this file doesn't exist
    if (!container.exists()) {
      continue;
    }

    if (VfsUtilCore.isAncestor(container, file, false /* allow them to be the same */)) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:IdeaSourceProvider.java

示例6: copyProperties

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public static void copyProperties(final String targetPath, final String fileName) throws IOException {
  final File targetDir = new File(targetPath).getAbsoluteFile();
  final File file = new File(targetDir, fileName);
  FileUtil.createParentDirs(file);
  for (File f = file; f != null && !FileUtil.filesEqual(f, targetDir); f = FileUtilRt.getParentFile(f)) {
    f.deleteOnExit();
  }
  final String resourceName = "/" + fileName;
  final InputStream stream = CopyResourcesUtil.class.getResourceAsStream(resourceName);
  if (stream == null) {
    return;
  }
  copyStreamToFile(stream, file);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:CopyResourcesUtil.java

示例7: calcEffectivePlatformCp

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
private static Collection<File> calcEffectivePlatformCp(Collection<File> platformCp, List<String> options, JavaCompilingTool compilingTool) {
  if (ourDefaultRtJar == null || !(compilingTool instanceof JavacCompilerTool)) {
    return platformCp;
  }
  boolean profileFeatureRequested = false;
  for (String option : options) {
    if ("-profile".equalsIgnoreCase(option)) {
      profileFeatureRequested = true;
      break;
    }
  }
  if (!profileFeatureRequested) {
    return platformCp;
  }
  boolean isTargetPlatformSameAsBuildRuntime = false;
  for (File file : platformCp) {
    if (FileUtil.filesEqual(file, ourDefaultRtJar)) {
      isTargetPlatformSameAsBuildRuntime = true;
      break;
    }
  }
  if (!isTargetPlatformSameAsBuildRuntime) {
    // compact profile was requested, but we have to use alternative platform classpath to meet project settings
    // consider this a compile error and let user re-configure the project 
    return null;
  }
  // returning empty list will force default behaviour for platform classpath calculation 
  // javac will resolve against its own bootclasspath and use ct.sym file when available 
  return Collections.emptyList();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:JavaBuilder.java

示例8: isExcludedFromCompilation

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public boolean isExcludedFromCompilation(@NotNull JpsModule module, @NotNull JpsModuleSourceRoot root) {
  final JpsJavaCompilerConfiguration compilerConfig = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(module.getProject());
  final ProcessorConfigProfile profile = compilerConfig.getAnnotationProcessingProfile(module);
  if (!profile.isEnabled()) {
    return false;
  }

  final File outputDir =
    ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir(module, JavaSourceRootType.TEST_SOURCE == root.getRootType(), profile);

  return outputDir != null && FileUtil.filesEqual(outputDir, root.getFile());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:AnnotationsExcludedJavaSourceRootProvider.java

示例9: copyFromRoot

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public void copyFromRoot(String filePath,
                         int rootIndex, String outputPath,
                         CompileContext context, BuildOutputConsumer outputConsumer,
                         ArtifactOutputToSourceMapping outSrcMapping) throws IOException, ProjectBuildException {
  final File file = new File(filePath);
  if (!file.exists()) return;
  String targetPath;
  if (!FileUtil.filesEqual(file, getRootFile())) {
    final String relativePath = FileUtil.getRelativePath(FileUtil.toSystemIndependentName(getRootFile().getPath()), filePath, '/');
    if (relativePath == null || relativePath.startsWith("..")) {
      throw new ProjectBuildException(new AssertionError(filePath + " is not under " + getRootFile().getPath()));
    }
    targetPath = JpsArtifactPathUtil.appendToPath(outputPath, relativePath);
  }
  else {
    targetPath = outputPath;
  }

  final File targetFile = new File(targetPath);
  if (FileUtil.filesEqual(file, targetFile)) {
    //do not process file if should be copied to itself. Otherwise the file will be included to source-to-output mapping and will be deleted by rebuild
    return;
  }

  if (outSrcMapping.getState(targetPath) == null) {
    ProjectBuilderLogger logger = context.getLoggingManager().getProjectBuilderLogger();
    if (logger.isEnabled()) {
      logger.logCompiledFiles(Collections.singletonList(file), IncArtifactBuilder.BUILDER_NAME, "Copying file:");
    }
    myCopyingHandler.copyFile(file, targetFile, context);
    outputConsumer.registerOutputFile(targetFile, Collections.singletonList(filePath));
  }
  else if (LOG.isDebugEnabled()) {
    LOG.debug("Target path " + targetPath + " is already registered so " + filePath + " won't be copied");
  }
  outSrcMapping.appendData(targetPath, rootIndex, filePath);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:FileBasedArtifactRootDescriptor.java

示例10: getWcInfo

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private WCInfo getWcInfo() {
  WCInfo found = null;
  final File workingIoFile = new File(myWorkingCopyDir.getPath());
  final List<WCInfo> infos = myVcs.getAllWcInfos();
  for (WCInfo info : infos) {
    if (FileUtil.filesEqual(workingIoFile, new File(info.getPath()))) {
      found = info;
      break;
    }
  }
  Assert.assertNotNull(found);
  return found;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:SvnQuickMergeTest.java

示例11: equals

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;

  CompiledClass aClass = (CompiledClass)o;

  if (!FileUtil.filesEqual(myOutputFile, aClass.myOutputFile)) return false;

  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:CompiledClass.java

示例12: hasParentIn

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static boolean hasParentIn(Collection<File> allFiles, File file) {
  final String filePath = file.getPath();
  for (File file1 : allFiles) {
    if (FileUtil.filesEqual(file1, file)) continue;
    if (filePath.startsWith(file1.getPath())) return true;
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ChooseCheckoutMode.java

示例13: cleanupRemovedClass

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private void cleanupRemovedClass(final Mappings delta, @NotNull final ClassRepr cr, File sourceFile, final Set<UsageRepr.Usage> usages, final IntIntMultiMaplet dependenciesTrashBin) {
  final int className = cr.name;

  // it is safe to cleanup class information if it is mapped to non-existing files only
  final Collection<File> currentlyMapped = myClassToSourceFile.get(className);
  if (currentlyMapped == null || currentlyMapped.isEmpty()) {
    return;
  }
  if (currentlyMapped.size() == 1) {
    if (!FileUtil.filesEqual(sourceFile, currentlyMapped.iterator().next())) {
      // if classname is already mapped to a different source, the class with such FQ name exists elsewhere, so
      // we cannot destroy all these links
      return;
    }
  }
  else {
    // many files
    for (File file : currentlyMapped) {
      if (!FileUtil.filesEqual(sourceFile, file) && file.exists()) {
        return;
      }
    }
  }

  for (final int superSomething : cr.getSupers()) {
    delta.registerRemovedSuperClass(className, superSomething);
  }

  cleanupBackDependency(className, usages, dependenciesTrashBin);

  myClassToClassDependency.remove(className);
  myClassToSubclasses.remove(className);
  myClassToSourceFile.remove(className);
  if (!cr.isLocal() && !cr.isAnonymous()) {
    myShortClassNameIndex.removeFrom(myContext.get(cr.getShortName()), className);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:Mappings.java

示例14: filesEqual

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public static boolean filesEqual(@Nullable File file1, @Nullable File file2) {
  try {
    return FileUtil.pathsEqual(file1 == null ? null : file1.getCanonicalPath(), file2 == null ? null : file2.getCanonicalPath());
  }
  catch (IOException e) {
    LOG.warn("unable to get canonical file path", e);
  }
  return FileUtil.filesEqual(file1, file2);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ExternalSystemUtil.java

示例15: removeDuplicatingClasses

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public static void removeDuplicatingClasses(final Module module, @NotNull final String packageName, @NotNull String className,
                                            @Nullable File classFile, String sourceRootPath) {
  if (sourceRootPath == null) {
    return;
  }
  VirtualFile sourceRoot = LocalFileSystem.getInstance().findFileByPath(sourceRootPath);
  if (sourceRoot == null) {
    return;
  }
  final Project project = module.getProject();
  final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
  final String interfaceQualifiedName = packageName + '.' + className;
  PsiClass[] classes = facade.findClasses(interfaceQualifiedName, GlobalSearchScope.moduleScope(module));
  final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  for (PsiClass c : classes) {
    PsiFile psiFile = c.getContainingFile();
    if (className.equals(FileUtil.getNameWithoutExtension(psiFile.getName()))) {
      VirtualFile virtualFile = psiFile.getVirtualFile();
      if (virtualFile != null && Comparing.equal(projectFileIndex.getSourceRootForFile(virtualFile), sourceRoot)) {
        final String path = virtualFile.getPath();
        final File f = new File(path);

        if (!FileUtil.filesEqual(f, classFile) && f.exists()) {
          if (f.delete()) {
            virtualFile.refresh(true, false);
          }
          else {
            ApplicationManager.getApplication().invokeLater(new Runnable() {
              @Override
              public void run() {
                Messages.showErrorDialog(project, "Can't delete file " + path, CommonBundle.getErrorTitle());
              }
            }, project.getDisposed());
          }
        }
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:40,代碼來源:AndroidCompileUtil.java


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