Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2010-11-04 10:05:08 +0000
committerMarkus Schorn2010-11-04 10:05:08 +0000
commit279038ad1858cb2e9a4da811d217523dc40aa626 (patch)
tree66e344de844b105c35b0aaf1e2e6c80db5a321bd
parentc465508c816765f745cd6e6e771446d676e10fa4 (diff)
downloadorg.eclipse.cdt-279038ad1858cb2e9a4da811d217523dc40aa626.tar.gz
org.eclipse.cdt-279038ad1858cb2e9a4da811d217523dc40aa626.tar.xz
org.eclipse.cdt-279038ad1858cb2e9a4da811d217523dc40aa626.zip
Bug 312666: Default file system on Mac is case insensitive.
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/ASTFilePathResolver.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerInputAdapter.java3
5 files changed, 19 insertions, 12 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java
index c6371e4083a..6a632814a96 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java
@@ -33,12 +33,13 @@ import org.eclipse.core.runtime.Path;
*/
public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
private final HashMap<String, IIndexFileLocation> fIflCache= new HashMap<String, IIndexFileLocation>();
- private final FileExistsCache fExistsCache = new FileExistsCache();
+ private final FileExistsCache fExistsCache;
private final StandaloneIndexer fIndexer;
public StandaloneIndexerInputAdapter(StandaloneIndexer indexer) {
fIndexer= indexer;
+ fExistsCache= new FileExistsCache(isCaseInsensitiveFileSystem());
}
@Override
@@ -184,4 +185,11 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
return true;
return fIndexer.getValidSourceUnitNames().contains(path.getFileExtension());
}
+
+ @SuppressWarnings("nls")
+ @Override
+ public boolean isCaseInsensitiveFileSystem() {
+ return new File("a").equals(new File("A"));
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/ASTFilePathResolver.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/ASTFilePathResolver.java
index 0054ddc1b4b..3215c4013b6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/ASTFilePathResolver.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/ASTFilePathResolver.java
@@ -49,4 +49,9 @@ public abstract class ASTFilePathResolver {
* Returns the size of the file in bytes, or -1 if it cannot be determined
*/
public abstract long getFileSize(String astFilePath);
+
+ /**
+ * Returns whether the file-system is case insensitive.
+ */
+ public abstract boolean isCaseInsensitiveFileSystem();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java
index b47af49a936..d0d7b9f142c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java
@@ -26,7 +26,6 @@ import java.util.Map;
*/
public final class FileExistsCache {
private static final Content EMPTY_STRING_ARRAY= new Content(new String[0]);
- private static final boolean CASE_INSENSITIVE = new File("a").equals(new File("A")); //$NON-NLS-1$ //$NON-NLS-2$
private static boolean BYPASS_CACHE= Boolean.getBoolean("CDT_INDEXER_BYPASS_FILE_EXISTS_CACHE"); //$NON-NLS-1$
private static class Content {
@@ -40,10 +39,6 @@ public final class FileExistsCache {
private Reference<Map<String,Content>> fCache= null;
private final boolean fCaseInSensitive;
- public FileExistsCache() {
- this(CASE_INSENSITIVE);
- }
-
public FileExistsCache(boolean caseInsensitive) {
fCaseInSensitive= caseInsensitive;
fCache= new SoftReference<Map<String,Content>>(new HashMap<String, Content>()); // before running out of memory the entire map will be thrown away.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java
index 019ca8dbc92..1edfa61b7dd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.indexer;
-import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -33,16 +32,15 @@ import org.eclipse.core.runtime.Path;
public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileResolutionHeuristics {
private static final String TRUE = "true"; //$NON-NLS-1$
- @SuppressWarnings("nls")
- private static final boolean IGNORE_CASE = new File("a").equals(new File("A"));
-
private IProject fProject;
private IProject[] fProjects;
private final ASTFilePathResolver fResolver;
+ private final boolean fIgnoreCase;
public ProjectIndexerIncludeResolutionHeuristics(IProject project, ASTFilePathResolver resolver) {
fProject= project;
fResolver= resolver;
+ fIgnoreCase= resolver.isCaseInsensitiveFileSystem();
}
public String findInclusion(String include, String currentFile) {
@@ -68,7 +66,7 @@ public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileRe
}
}
- IFile[] files= ResourceLookup.findFilesByName(new Path(include), fProjects, IGNORE_CASE);
+ IFile[] files= ResourceLookup.findFilesByName(new Path(include), fProjects, fIgnoreCase);
if (files.length == 0)
return null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerInputAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerInputAdapter.java
index 21860d2a47a..9b7bca315b2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerInputAdapter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerInputAdapter.java
@@ -79,7 +79,8 @@ public class ProjectIndexerInputAdapter extends IndexerInputAdapter {
}
}
- private boolean isCaseInsensitiveFileSystem() {
+ @Override
+ public boolean isCaseInsensitiveFileSystem() {
if (Platform.OS_MACOSX.equals(Platform.getOS()))
return true;
return CASE_INSENSITIVE_FILE_SYSTEM;

Back to the top