本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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());
}
}
}
}
}
}