From 44631209e6baebcd22326ea20b10495bccd221d2 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sat, 19 Sep 2026 08:11:50 +0200 Subject: [PATCH] Add Option to ignore file name casing in IFileStore.fetchInfo() Introduce a new file-system option `EFS.IGNORE_NAME_CASE` and add a fast-path to Win32Handler in case that option is set to not determine the file's real name on the file-system. Additionally overwrite Win32Handler.listDirectoryAndGetFileInfos(String) to leverage that new fast-path, too. --- .../internal/core/LaunchConfiguration.java | 2 +- .../src/org/eclipse/core/filesystem/EFS.java | 13 +++- .../eclipse/core/filesystem/IFileStore.java | 22 +++++- .../core/filesystem/provider/FileStore.java | 4 +- .../core/internal/filesystem/FileCache.java | 13 +++- .../internal/filesystem/local/LocalFile.java | 10 +-- .../local/LocalFileNativesManager.java | 6 +- .../filesystem/local/NativeHandler.java | 7 +- .../filesystem/local/Win32Handler.java | 74 ++++++++++++++++++- .../local/linux/LinuxFileHandler.java | 2 +- .../filesystem/local/nio/DefaultHandler.java | 2 +- .../filesystem/local/nio/PosixHandler.java | 2 +- .../local/unix/UnixFileHandler.java | 2 +- .../core/internal/localstore/CopyVisitor.java | 3 +- .../internal/localstore/DeleteVisitor.java | 19 ++++- .../localstore/FileSystemResourceManager.java | 54 +++++++++----- .../internal/localstore/HistoryStore2.java | 3 +- .../eclipse/core/internal/resources/File.java | 6 +- .../core/internal/resources/Folder.java | 4 +- .../core/internal/resources/Resource.java | 2 +- .../core/internal/resources/ResourceTree.java | 14 +++- .../core/resources/ResourceAttributes.java | 2 +- .../internal/localstore/BlobStoreTest.java | 2 +- .../LinkedResourceWithPathVariableTest.java | 2 +- .../tests/resources/ResourceTestUtil.java | 2 +- .../resources/regression/Bug_530868.java | 3 +- 26 files changed, 209 insertions(+), 66 deletions(-) diff --git a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java index 1be6ba8b6c7..c980ad783ac 100644 --- a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java +++ b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java @@ -870,7 +870,7 @@ public boolean isReadOnly() { try { IFileStore fileStore = getFileStore(); if (fileStore != null) { - return fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_READ_ONLY); + return fileStore.fetchInfo(EFS.IGNORE_NAME_CASE, null).getAttribute(EFS.ATTRIBUTE_READ_ONLY); } } catch (CoreException e) { } diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/EFS.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/EFS.java index b7deb276729..7de5c1d89de 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/EFS.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/EFS.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2013 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -105,6 +105,17 @@ public class EFS { */ public static final int CACHE = 1 << 12; + /** + * Option flag constant (value 1 <<13) indicating that + * the exact casing of a file's name does not need to be determined. + *

+ * For case-insensitive file-systems, like on Windows, this can accelerate fetching file information. + *

+ * @see IFileStore#fetchInfo(int, IProgressMonitor) + * @since 1.12 + */ + public static final int IGNORE_NAME_CASE = 1 << 13; + /** * Attribute constant (value 1 <<1) indicating that a * file is read only. diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java index 43aed9e1230..7150f1b9538 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java @@ -210,9 +210,14 @@ public interface IFileStore extends IAdaptable { * file, the returned info will include the file's name and will return false * when IFileInfo#exists() is called, but all other information will assume default * values. + *

+ *

+ * The {@link EFS#IGNORE_NAME_CASE} option flag indicates if + * the casing of this file's name on the file-system is determined or not. + * This is only relevant for case-insensitive file-systems, but can accelerate the fetch. + *

* - * @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} - * is applicable). + * @param options bit-wise or of option flag constants ({@link EFS#NONE} or {@link EFS#IGNORE_NAME_CASE}). * @param monitor a progress monitor, or null if progress * reporting and cancellation are not desired * @return A structure containing information about this file. @@ -221,6 +226,7 @@ public interface IFileStore extends IAdaptable { *
  • Problems occurred while contacting the file system.
  • * * @see IFileTree#getFileInfo(IFileStore) + * @see EFS#IGNORE_NAME_CASE */ public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException; @@ -231,7 +237,11 @@ public interface IFileStore extends IAdaptable { * @since 1.12 */ public default boolean exists() { - return fetchInfo().exists(); + try { + return fetchInfo(EFS.IGNORE_NAME_CASE, null).exists(); + } catch (CoreException e) { + return false; + } } /** @@ -241,7 +251,11 @@ public default boolean exists() { * @since 1.12 */ public default boolean isDirectory() { - return fetchInfo().isDirectory(); + try { + return fetchInfo(EFS.IGNORE_NAME_CASE, null).isDirectory(); + } catch (CoreException e) { + return false; + } } /** diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java index 9f80e87f327..d801afd18bd 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java @@ -95,7 +95,7 @@ public IFileStore[] childStores(int options, IProgressMonitor monitor) throws Co */ @Override public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { - final IFileInfo sourceInfo = fetchInfo(EFS.NONE, null); + final IFileInfo sourceInfo = fetchInfo(EFS.IGNORE_NAME_CASE, null); if (sourceInfo.isDirectory()) { copyDirectory(sourceInfo, destination, options, monitor); } else { @@ -178,7 +178,7 @@ protected void copyFile(IFileInfo sourceInfo, IFileStore destination, int option Policy.error(EFS.ERROR_WRITE, NLS.bind(Messages.failedCopy, sourcePath), e); } catch (CoreException e) { //if we failed to write, try to cleanup the half written file - if (!destination.fetchInfo(0, null).exists()) { + if (!destination.fetchInfo(EFS.IGNORE_NAME_CASE, null).exists()) { destination.delete(EFS.NONE, null); } throw e; diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/FileCache.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/FileCache.java index b0e709c93a3..e4310705fcf 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/FileCache.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/FileCache.java @@ -15,10 +15,15 @@ import java.io.File; import java.io.IOException; -import org.eclipse.core.filesystem.*; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileInfo; +import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.filesystem.provider.FileStore; import org.eclipse.core.internal.filesystem.local.LocalFile; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubMonitor; import org.eclipse.osgi.service.environment.Constants; import org.eclipse.osgi.util.NLS; @@ -93,7 +98,7 @@ public static FileCache getCache() throws CoreException { public java.io.File cache(IFileStore source, IProgressMonitor monitor) throws CoreException { try { SubMonitor subMonitor = SubMonitor.convert(monitor, NLS.bind(Messages.copying, toString()), 3); - IFileInfo myInfo = source.fetchInfo(EFS.NONE, subMonitor.newChild(1)); + IFileInfo myInfo = source.fetchInfo(EFS.IGNORE_NAME_CASE, subMonitor.newChild(1)); if (!myInfo.exists()) { return new File(cacheDir, "Non-Existent-" + System.currentTimeMillis()); //$NON-NLS-1$ } @@ -141,7 +146,7 @@ private void clearImmutableFlag(File target) { } else { LocalFile lfile = new LocalFile(target); try { - IFileInfo info = lfile.fetchInfo(EFS.NONE, null); + IFileInfo info = lfile.fetchInfo(EFS.IGNORE_NAME_CASE, null); if (info.getAttribute(EFS.ATTRIBUTE_IMMUTABLE)) { info.setAttribute(EFS.ATTRIBUTE_IMMUTABLE, false); lfile.putInfo(info, EFS.SET_ATTRIBUTES, null); diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java index c70b677e1a9..852e641bc76 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2024 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -232,7 +232,7 @@ public boolean equals(Object obj) { @Override public IFileInfo fetchInfo(int options, IProgressMonitor monitor) { - FileInfo info = LocalFileNativesManager.fetchFileInfo(filePath); + FileInfo info = LocalFileNativesManager.fetchFileInfo(filePath, options); //natives don't set the file name on all platforms if (info.getName().isEmpty()) { String name = file.getName(); @@ -296,7 +296,7 @@ private static ForkJoinPool createExecutor(int threadCount) { /* corePoolSize */ 0, // /* maximumPoolSize */ threadCount, // /* minimumRunnable */ 0, // - pool -> true, // if maximumPoolSize would be exceeded, don't throw RejectedExecutionException + _ -> true, // if maximumPoolSize would be exceeded, don't throw RejectedExecutionException /* keepAliveTime */ 1, TimeUnit.MINUTES); // pool terminates 1 thread per } @@ -376,7 +376,7 @@ private IStatus internalDelete(File target, InfiniteProgress infMonitor, Executo } // If we got this far, we failed. - String message = fetchInfo().getAttribute(EFS.ATTRIBUTE_READ_ONLY) // + String message = fetchInfo(EFS.IGNORE_NAME_CASE, null).getAttribute(EFS.ATTRIBUTE_READ_ONLY) // ? Messages.couldnotDeleteReadOnly // This is the worst-case scenario: something failed but we don't know what. The children were @@ -499,7 +499,7 @@ public void move(IFileStore destFile, int options, IProgressMonitor monitor) thr // source exists but destination doesn't so try to copy below } else { // destination.exists() returns false for broken links, this has to be handled explicitly - if (!destination.exists() && !destFile.fetchInfo().getAttribute(EFS.ATTRIBUTE_SYMLINK)) { + if (!destination.exists() && !destFile.fetchInfo(EFS.IGNORE_NAME_CASE, null).getAttribute(EFS.ATTRIBUTE_SYMLINK)) { // neither the source nor the destination exist. this is REALLY bad String message = NLS.bind(Messages.failedMove, source.getAbsolutePath(), destination.getAbsolutePath()); Policy.error(EFS.ERROR_WRITE, message); diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java index 6142c2755ba..ad42b27def9 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2016 IBM Corporation and others. + * Copyright (c) 2010, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -88,8 +88,8 @@ public static int getSupportedAttributes() { return HANDLER.getSupportedAttributes(); } - public static FileInfo fetchFileInfo(String fileName) { - return HANDLER.fetchFileInfo(fileName); + public static FileInfo fetchFileInfo(String fileName, int options) { + return HANDLER.fetchFileInfo(fileName, options); } public static boolean putFileInfo(String fileName, IFileInfo info) { diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/NativeHandler.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/NativeHandler.java index 656b1781f1a..243397347ff 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/NativeHandler.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/NativeHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 IBM Corporation and others. + * Copyright (c) 2012, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,6 +14,7 @@ package org.eclipse.core.internal.filesystem.local; import java.io.File; +import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.provider.FileInfo; @@ -23,7 +24,7 @@ public abstract class NativeHandler { public abstract int getSupportedAttributes(); - public abstract FileInfo fetchFileInfo(String fileName); + public abstract FileInfo fetchFileInfo(String fileName, int options); public abstract boolean putFileInfo(String fileName, IFileInfo info); @@ -38,7 +39,7 @@ public IFileInfo[] listDirectoryAndGetFileInfos(String fileName) { var directoryContents = listDirectoryNames(fileName); var result = new IFileInfo[directoryContents.length]; for (int i = 0; i < directoryContents.length; i++) { - result[i] = fetchFileInfo(fileName + File.separator + directoryContents[i]); + result[i] = fetchFileInfo(fileName + File.separator + directoryContents[i], EFS.NONE); } return result; } diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Win32Handler.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Win32Handler.java index e6cde24799a..88f8a88e891 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Win32Handler.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Win32Handler.java @@ -27,13 +27,19 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; import java.nio.charset.StandardCharsets; +import java.nio.file.DirectoryStream; import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; +import java.nio.file.attribute.DosFileAttributes; import java.time.Instant; import java.time.LocalDateTime; import java.time.Month; import java.time.ZoneOffset; import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.provider.FileInfo; @@ -70,7 +76,7 @@ public int getSupportedAttributes() { * Depending on the length of the path, this implementation is consequently multiple times, up to a magnitude faster than the mentioned Java API. */ @Override - public FileInfo fetchFileInfo(String fileName) { + public FileInfo fetchFileInfo(String fileName, int options) { FileInfo fileInfo = new FileInfo(); String target = toLongWindowsPath(fileName); @@ -83,6 +89,11 @@ public FileInfo fetchFileInfo(String fileName) { fileInfo.setExists(Files.exists(file)); return fileInfo; } + if ((options & EFS.IGNORE_NAME_CASE) != 0) { + // Use faster method to read file attributes without determining the real casing of its name + readDosFileAttributesIntoFileInfo(fileInfo, file); + return fileInfo; + } try (Arena arena = Arena.ofConfined()) { MemorySegment lpFileName = allocateWideString(target, arena); @SuppressWarnings("static-access") @@ -140,6 +151,25 @@ private static int GetLastError(MemorySegment capturedError) { return (int) GET_LAST_ERROR_HANDLE.get(capturedError, 0L); } + private static final IFileInfo[] EMPTY_FILEINFO_ARRAY = {}; + + @Override + public IFileInfo[] listDirectoryAndGetFileInfos(String fileName) { + Path file = Path.of(fileName); + List children = new ArrayList<>(); + try (DirectoryStream directoryContent = Files.newDirectoryStream(file);) { + for (Path child : directoryContent) { + FileInfo fileInfo = new FileInfo(); + // The directory stream delivers real names and therefore the faster method can be used + readDosFileAttributesIntoFileInfo(fileInfo, child); + children.add(fileInfo); + } + } catch (IOException e) { + return EMPTY_FILEINFO_ARRAY; + } + return children.toArray(IFileInfo[]::new); + } + /** * Sets the given {@link IFileInfo} to the given file. * @@ -213,6 +243,38 @@ private static String toLongWindowsPath(String fileName) { } } + /** + * Reads the DOS file attributes of the file without determining its real name + * (which may have different letter case, because the Window file system is case-insensitive). + * + * This is significantly faster than using {@code FindFirstFileW()}, which effectively searches a directory + * and requires two native calls. + */ + private static void readDosFileAttributesIntoFileInfo(FileInfo fileInfo, Path path) { + try { + DosFileAttributes attributes = Files.readAttributes(path, DosFileAttributes.class, LinkOption.NOFOLLOW_LINKS); + + fileInfo.setName(path.getFileName().toString()); // path is not a root, so filename is available + fileInfo.setExists(true); + fileInfo.setLastModified(attributes.lastModifiedTime().toMillis()); + fileInfo.setLength(attributes.size()); + fileInfo.setDirectory(attributes.isDirectory()); + fileInfo.setAttribute(EFS.ATTRIBUTE_ARCHIVE, attributes.isArchive()); + fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, attributes.isReadOnly()); + fileInfo.setAttribute(EFS.ATTRIBUTE_HIDDEN, attributes.isHidden()); + if (attributes.isSymbolicLink()) { + setSymLink(path, fileInfo); + // For sym-links, DosFileAttributes.isDirectory() always returns false. + // Determine the real type of the link target and follow-links to the eventual target + fileInfo.setDirectory(Files.isDirectory(path)); + } + } catch (NoSuchFileException _) { // file just does not exist + } catch (IOException _) { + // Leave alone and continue. + fileInfo.setError(IFileInfo.IO_ERROR); + } + } + @SuppressWarnings("static-access") private static void convertFindDataWToFileInfo(MemorySegment mem, FileInfo info, Path file) throws IOException { /** @@ -240,12 +302,16 @@ private static void convertFindDataWToFileInfo(MemorySegment mem, FileInfo info, boolean isReparsePoint = isSet(dwFileAttributes, FileAPI.FILE_ATTRIBUTE_REPARSE_POINT()); if (isReparsePoint && dwReserved0 == FileAPI.IO_REPARSE_TAG_SYMLINK()) { - Path linkTarget = Files.readSymbolicLink(file); - info.setAttribute(EFS.ATTRIBUTE_SYMLINK, true); - info.setStringAttribute(EFS.ATTRIBUTE_LINK_TARGET, linkTarget.toString()); + setSymLink(file, info); } } + private static void setSymLink(Path path, FileInfo info) throws IOException { + Path linkTarget = Files.readSymbolicLink(path); + info.setAttribute(EFS.ATTRIBUTE_SYMLINK, true); + info.setStringAttribute(EFS.ATTRIBUTE_LINK_TARGET, linkTarget.toString()); + } + private static final Instant WINDOWS_REFERENCE_DATE = LocalDateTime.of(1601, Month.JANUARY, 1, 0, 0).toInstant(ZoneOffset.UTC); // https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/linux/LinuxFileHandler.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/linux/LinuxFileHandler.java index a7ff7ab0c4d..ca4be509588 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/linux/LinuxFileHandler.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/linux/LinuxFileHandler.java @@ -27,7 +27,7 @@ public int getSupportedAttributes() { } @Override - public FileInfo fetchFileInfo(String fileName) { + public FileInfo fetchFileInfo(String fileName, int options) { return LinuxFileNatives.fetchFileInfo(fileName); } diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/DefaultHandler.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/DefaultHandler.java index 38c2ed88dba..d226083dcf2 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/DefaultHandler.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/DefaultHandler.java @@ -36,7 +36,7 @@ public class DefaultHandler extends NativeHandler { | EFS.ATTRIBUTE_READ_ONLY | EFS.ATTRIBUTE_EXECUTABLE; // based on Java API @Override - public FileInfo fetchFileInfo(String fileName) { + public FileInfo fetchFileInfo(String fileName, int options) { Path path = Paths.get(fileName); FileInfo info = new FileInfo(); boolean exists = Files.exists(path); diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/PosixHandler.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/PosixHandler.java index 726f11c20b7..7320a307944 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/PosixHandler.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/nio/PosixHandler.java @@ -43,7 +43,7 @@ public class PosixHandler extends NativeHandler { | EFS.ATTRIBUTE_OTHER_READ | EFS.ATTRIBUTE_OTHER_WRITE | EFS.ATTRIBUTE_OTHER_EXECUTE; // other @Override - public FileInfo fetchFileInfo(String fileName) { + public FileInfo fetchFileInfo(String fileName, int options) { Path path = Paths.get(fileName); FileInfo info = new FileInfo(); diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileHandler.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileHandler.java index 52016487e9d..189eca2956b 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileHandler.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileHandler.java @@ -27,7 +27,7 @@ public int getSupportedAttributes() { } @Override - public FileInfo fetchFileInfo(String fileName) { + public FileInfo fetchFileInfo(String fileName, int options) { return UnixFileNatives.fetchFileInfo(fileName); } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/CopyVisitor.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/CopyVisitor.java index 464fc908a75..f7cb9e64e71 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/CopyVisitor.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/CopyVisitor.java @@ -124,7 +124,8 @@ protected boolean copyContents(UnifiedTreeNode node, Resource source, Resource d sourceStore.copy(destinationStore, EFS.SHALLOW, subMonitor.newChild(1)); //create the destination in the workspace ResourceInfo info = localManager.getWorkspace().createResource(destination, updateFlags); - localManager.updateLocalSync(info, destinationStore.fetchInfo().getLastModified()); + localManager.updateLocalSync(info, + destinationStore.fetchInfo(EFS.IGNORE_NAME_CASE, null).getLastModified()); //update timestamps on aliases getWorkspace().getAliasManager().updateAliases(destination, destinationStore, IResource.DEPTH_ZERO, monitor); if (destination.getType() == IResource.FILE) { diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java index b42d2e76afd..c48830e766b 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java @@ -17,15 +17,22 @@ import java.util.Iterator; import java.util.List; -import org.eclipse.core.filesystem.*; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileInfo; +import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.filesystem.provider.FileInfo; import org.eclipse.core.internal.resources.ICoreConstants; import org.eclipse.core.internal.resources.Resource; import org.eclipse.core.internal.resources.Workspace; import org.eclipse.core.internal.utils.Messages; import org.eclipse.core.internal.utils.Policy; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceStatus; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.SubMonitor; import org.eclipse.osgi.util.NLS; public class DeleteVisitor implements IUnifiedTreeVisitor, ICoreConstants { @@ -125,7 +132,11 @@ private void recursiveKeepHistory(IHistoryStore store, UnifiedTreeNode node) { } else { IFileInfo info = node.fileInfo; if (info == null) { - info = new FileInfo(node.getLocalName()); + try { + info = node.getStore().fetchInfo(EFS.IGNORE_NAME_CASE, null); + } catch (CoreException e) { + info = new FileInfo(node.getLocalName()); + } } if (((Workspace) target.getWorkspace()).getFileSystemManager().storeHistory(target)) { store.addState(target.getFullPath(), node.getStore(), info, true); diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java index e39ab8a650d..bac5d58e2da 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java @@ -327,7 +327,12 @@ public IResource[] allResourcesFor(URI location, boolean files, int memberFlags) */ public ResourceAttributes attributes(IResource resource) { IFileStore store = getStore(resource); - IFileInfo fileInfo = store.fetchInfo(); + IFileInfo fileInfo; + try { + fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); + } catch (CoreException e) { + return null; + } if (!fileInfo.exists()) { return null; } @@ -531,8 +536,8 @@ public int doGetEncoding(IFileStore store) throws CoreException { public boolean fastIsSynchronized(File target) { ResourceInfo info = target.getResourceInfo(false, false); if (target.exists(target.getFlags(info), true)) { - IFileInfo fileInfo = getStore(target).fetchInfo(); - if (!fileInfo.isDirectory() && info.getLocalSyncInfo() == fileInfo.getLastModified()) { + IFileInfo fileInfo = fetchResourceInfo(getStore(target)); + if (fileInfo != null && !fileInfo.isDirectory() && info.getLocalSyncInfo() == fileInfo.getLastModified()) { return true; } } @@ -542,14 +547,22 @@ public boolean fastIsSynchronized(File target) { public boolean fastIsSynchronized(Folder target) { ResourceInfo info = target.getResourceInfo(false, false); if (target.exists(target.getFlags(info), true)) { - IFileInfo fileInfo = getStore(target).fetchInfo(); - if (!fileInfo.exists() && info.getLocalSyncInfo() == fileInfo.getLastModified()) { + IFileInfo fileInfo = fetchResourceInfo(getStore(target)); + if (fileInfo != null && !fileInfo.exists() && info.getLocalSyncInfo() == fileInfo.getLastModified()) { return true; } } return false; } + private static IFileInfo fetchResourceInfo(IFileStore store) { + try { + return store.fetchInfo(EFS.IGNORE_NAME_CASE, null); + } catch (CoreException e) { + return null; + } + } + /** * Returns an IFile for the given file system location or null if there * is no mapping for this path. This method does NOT check the existence @@ -751,7 +764,7 @@ public boolean internalWrite(IProject target, IProjectDescription description, i } } IFileStore descriptionFileStore = ((Resource) descriptionFile).getStore(); - IFileInfo fileInfo = descriptionFileStore.fetchInfo(); + IFileInfo fileInfo = descriptionFileStore.fetchInfo(EFS.IGNORE_NAME_CASE, null); if (fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY)) { IStatus result = getWorkspace().validateEdit(new IFile[] {descriptionFile}, null); @@ -759,7 +772,7 @@ public boolean internalWrite(IProject target, IProjectDescription description, i throw new ResourceException(result); } // re-read the file info in case the file attributes were modified - fileInfo = descriptionFileStore.fetchInfo(); + fileInfo = descriptionFileStore.fetchInfo(EFS.IGNORE_NAME_CASE, null); } //write the project description file (don't use API because scheduling rule might not match) @@ -790,7 +803,13 @@ public boolean isDescriptionSynchronized(IProject target) { if (projectInfo == null) { return false; } - return projectInfo.getLocalSyncInfo() == getStore(descriptionFile).fetchInfo().getLastModified(); + long lastModified; + try { + lastModified = getStore(descriptionFile).fetchInfo(EFS.IGNORE_NAME_CASE, null).getLastModified(); + } catch (CoreException e) { + lastModified = 0; + } + return projectInfo.getLocalSyncInfo() == lastModified; } /** @@ -939,7 +958,7 @@ public InputStream read(IFile target, boolean force, IProgressMonitor monitor) t private IFileStore getFileStore(IFile target, boolean force) throws ResourceException, CoreException { IFileStore store = getStore(target); if (!force) { - final IFileInfo fileInfo = store.fetchInfo(); + final IFileInfo fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); Resource resource = (Resource) target; ResourceInfo info = resource.getResourceInfo(true, false); if (info == null) { @@ -1039,7 +1058,7 @@ public ProjectDescription read(IProject target, boolean creation) throws CoreExc description.updateDynamicState(privateDescription); } } - long lastModified = descriptionStore.fetchInfo().getLastModified(); + long lastModified = descriptionStore.fetchInfo(EFS.IGNORE_NAME_CASE, null).getLastModified(); IFile descriptionFile = target.getFile(IProjectDescription.DESCRIPTION_FILE_NAME); //don't get a mutable copy because we might be in restore which isn't an operation //it doesn't matter anyway because local sync info is not included in deltas @@ -1166,11 +1185,11 @@ protected IResource resourceFor(IPath path, boolean files) { */ public long setLocalTimeStamp(IResource target, ResourceInfo info, long value) throws CoreException { IFileStore store = getStore(target); - IFileInfo fileInfo = store.fetchInfo(); + IFileInfo fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); fileInfo.setLastModified(value); store.putInfo(fileInfo, EFS.SET_LAST_MODIFIED, null); //actual value may be different depending on file system granularity - fileInfo = store.fetchInfo(); + fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); long actualValue = fileInfo.getLastModified(); updateLocalSync(info, actualValue); return actualValue; @@ -1209,7 +1228,8 @@ public void setResourceAttributes(IResource resource, ResourceAttributes attribu //when the executable bit is changed on a folder a refresh is required boolean refresh = false; if (resource instanceof IContainer && ((store.getFileSystem().attributes() & EFS.ATTRIBUTE_EXECUTABLE) != 0)) { - refresh = store.fetchInfo().getAttribute(EFS.ATTRIBUTE_EXECUTABLE) != attributes.isExecutable(); + IFileInfo info = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); + refresh = info.getAttribute(EFS.ATTRIBUTE_EXECUTABLE) != attributes.isExecutable(); } store.putInfo(FileUtil.attributesToFileInfo(attributes), EFS.SET_ATTRIBUTES, null); //must refresh in the background because we are not inside an operation @@ -1307,7 +1327,7 @@ public void write(IFile target, InputStream content, IFileInfo fileInfo, int upd || !Platform.getOS().equals(Platform.OS_WIN32)) { throw e; } - fileInfo = store.fetchInfo(); + fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); if (!(fileInfo.exists() && fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN))) { throw e; } @@ -1394,7 +1414,7 @@ && storeHistory(target)) { private void finishWrite(Resource targetResource, IFileStore store) throws CoreException { // get the new last modified time and stash in the info - long lastModified = store.fetchInfo().getLastModified(); + long lastModified = store.fetchInfo(EFS.IGNORE_NAME_CASE, null).getLastModified(); ResourceInfo mutableTargetResourceInfo = targetResource.getResourceInfo(false, true); if (mutableTargetResourceInfo == null) { // If the resource info is null, the resource must have been concurrently @@ -1464,7 +1484,7 @@ public void write(IFile target, byte[] content, IFileInfo fileInfo, int updateFl public void write(IFolder target, boolean force, IProgressMonitor monitor) throws CoreException { IFileStore store = getStore(target); if (!force) { - IFileInfo fileInfo = store.fetchInfo(); + IFileInfo fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); if (fileInfo.isDirectory()) { String message = NLS.bind(Messages.localstore_resourceExists, target.getFullPath()); throw new ResourceException(IResourceStatus.EXISTS_LOCAL, target.getFullPath(), message, null); @@ -1476,7 +1496,7 @@ public void write(IFolder target, boolean force, IProgressMonitor monitor) throw } store.mkdir(EFS.NONE, monitor); ResourceInfo info = ((Resource) target).getResourceInfo(false, true); - updateLocalSync(info, store.fetchInfo().getLastModified()); + updateLocalSync(info, store.fetchInfo(EFS.IGNORE_NAME_CASE, null).getLastModified()); } public boolean storeHistory(IResource file) { diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java index f9879d424e7..fcfb75d3931 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java @@ -114,7 +114,8 @@ public HistoryStore2(Workspace workspace, IFileStore store, int limit) { public synchronized IFileState addState(IPath key, IFileStore localFile, IFileInfo info, boolean moveContents) { long lastModified = info.getLastModified(); if (Policy.DEBUG_HISTORY) { - Policy.debug("History: Adding state for key: " + key + ", file: " + localFile + ", timestamp: " + lastModified + ", size: " + localFile.fetchInfo().getLength()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + Policy.debug("History: Adding state for key: " + key + ", file: " + localFile + ", timestamp: " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + + lastModified + ", size: " + info.getLength()); //$NON-NLS-1$ } if (!isValid(localFile, info)) { return null; diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java index f1227ef42a9..5ea84c68652 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java @@ -88,7 +88,7 @@ public void appendContents(InputStream content, int updateFlags, IProgressMonito ResourceInfo info = getResourceInfo(false, false); checkAccessible(getFlags(info)); workspace.beginOperation(true); - IFileInfo fileInfo = getStore().fetchInfo(); + IFileInfo fileInfo = getStore().fetchInfo(EFS.IGNORE_NAME_CASE, null); internalSetContents(content, fileInfo, updateFlags, true, subMonitor.newChild(99)); } catch (OperationCanceledException e) { workspace.getWorkManager().operationCanceled(); @@ -503,7 +503,7 @@ public void setContents(InputStream content, int updateFlags, IProgressMonitor m ResourceInfo info = getResourceInfo(false, false); checkAccessible(getFlags(info)); workspace.beginOperation(true); - IFileInfo fileInfo = getStore().fetchInfo(); + IFileInfo fileInfo = getStore().fetchInfo(EFS.IGNORE_NAME_CASE, null); if (BitMask.isSet(updateFlags, IResource.DERIVED)) { // update of derived flag during IFile.write: info.set(ICoreConstants.M_DERIVED); @@ -536,7 +536,7 @@ public void setContents(byte[] content, int updateFlags, IProgressMonitor monito ResourceInfo info = getResourceInfo(false, false); checkAccessible(getFlags(info)); workspace.beginOperation(true); - IFileInfo fileInfo = getStore().fetchInfo(); + IFileInfo fileInfo = getStore().fetchInfo(EFS.IGNORE_NAME_CASE, null); if (BitMask.isSet(updateFlags, IResource.DERIVED)) { // update of derived flag during IFile.write: info.set(ICoreConstants.M_DERIVED); diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java index d6fb7271f75..5c13b372a24 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java @@ -15,6 +15,7 @@ package org.eclipse.core.internal.resources; import java.net.URI; +import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.internal.utils.Messages; @@ -97,7 +98,8 @@ public void create(int updateFlags, boolean local, IProgressMonitor monitor) thr try { workspace.prepareOperation(rule, newChild); IFileStore store = getStore(); - IFileInfo localInfo = store.fetchInfo(); + int fetchOptions = force && !Workspace.caseSensitive ? EFS.NONE : EFS.IGNORE_NAME_CASE; + IFileInfo localInfo = store.fetchInfo(fetchOptions, null); assertCreateRequirements(store, localInfo, updateFlags); workspace.beginOperation(true); if (force && !Workspace.caseSensitive && localInfo.exists()) { diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java index 98d9e2da8df..250c6f22ba2 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java @@ -221,7 +221,7 @@ protected IFileInfo assertLinkRequirements(URI localLocation, int updateFlags) t // Check if the file exists. URI resolved = getPathVariableManager().resolveURI(localLocation); IFileStore store = EFS.getStore(resolved); - IFileInfo fileInfo = store.fetchInfo(); + IFileInfo fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); boolean localExists = fileInfo.exists(); if (!allowMissingLocal && !localExists) { String msg = NLS.bind(Messages.links_localDoesNotExist, store.toString()); diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java index cdbb38e30f7..b9499e72345 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java @@ -92,7 +92,12 @@ public void addToLocalHistory(IFile file) { return; } IFileStore store = localManager.getStore(file); - final IFileInfo fileInfo = store.fetchInfo(); + IFileInfo fileInfo; + try { + fileInfo = store.fetchInfo(EFS.IGNORE_NAME_CASE, null); + } catch (CoreException e) { + return; + } if (!fileInfo.exists()) { return; } @@ -283,7 +288,12 @@ public long getTimestamp(IFile file) { * @return The local file system timestamp */ private long internalComputeTimestamp(IFile file) { - IFileInfo fileInfo = localManager.getStore(file).fetchInfo(); + IFileInfo fileInfo; + try { + fileInfo = localManager.getStore(file).fetchInfo(EFS.IGNORE_NAME_CASE, null); + } catch (CoreException e) { + return NULL_TIMESTAMP; + } return fileInfo.exists() ? fileInfo.getLastModified() : NULL_TIMESTAMP; } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourceAttributes.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourceAttributes.java index c307a4ec4d0..40df2124e15 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourceAttributes.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourceAttributes.java @@ -45,7 +45,7 @@ public class ResourceAttributes { */ public static ResourceAttributes fromFile(java.io.File file) { try { - return FileUtil.fileInfoToAttributes(EFS.getStore(file.toURI()).fetchInfo()); + return FileUtil.fileInfoToAttributes(EFS.getStore(file.toURI()).fetchInfo(EFS.IGNORE_NAME_CASE, null)); } catch (CoreException e) { //file could not be accessed return new ResourceAttributes(); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java index 4d9189d61e0..ef3244699f4 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java @@ -68,7 +68,7 @@ public void testConstructor() throws CoreException { private IFileStore createStore() throws CoreException { IFileStore root = fileStoreExtension.getTempStore(); root.mkdir(EFS.NONE, null); - IFileInfo info = root.fetchInfo(); + IFileInfo info = root.fetchInfo(EFS.IGNORE_NAME_CASE, null); assertTrue(info.exists()); assertTrue(info.isDirectory()); return root; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java index 3ba04f57078..1058a5cef81 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java @@ -656,7 +656,7 @@ public void testImportWrongLineEndings_Bug210664() throws Exception { // Set the project read-only projNew.move(projFile, EFS.OVERWRITE, createTestMonitor()); - IFileInfo info = projFile.fetchInfo(EFS.NONE, createTestMonitor()); + IFileInfo info = projFile.fetchInfo(EFS.IGNORE_NAME_CASE, createTestMonitor()); info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true); projFile.putInfo(info, EFS.SET_ATTRIBUTES, createTestMonitor()); toSetWritable = projFile; /* for cleanup */ diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java index 482957376ed..aa156cb9f47 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java @@ -416,7 +416,7 @@ public static boolean isReadOnlySupported() { public static void setReadOnly(IFileStore target, boolean value) throws CoreException { assertThat(isReadOnlySupported()).withFailMessage("setting read only is not supported by local file system") .isTrue(); - IFileInfo fileInfo = target.fetchInfo(); + IFileInfo fileInfo = target.fetchInfo(EFS.IGNORE_NAME_CASE, null); fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, value); target.putInfo(fileInfo, EFS.SET_ATTRIBUTES, null); } diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java index 39e0b33017e..0d34d89ac70 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_530868.java @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse; import java.io.ByteArrayInputStream; +import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.provider.FileInfo; import org.eclipse.core.internal.filesystem.local.LocalFileNativesManager; import org.eclipse.core.resources.IFile; @@ -93,7 +94,7 @@ private void setTestFileContents(String contents) throws Exception { private long getLastModificationTimestamp() { IPath testFileLocation = testFile.getLocation(); String filePath = testFileLocation.toOSString(); - FileInfo testFileInfo = LocalFileNativesManager.fetchFileInfo(filePath); + FileInfo testFileInfo = LocalFileNativesManager.fetchFileInfo(filePath, EFS.NONE); return testFileInfo.getLastModified(); }