Skip to content

Commit

Permalink
find proper file
Browse files Browse the repository at this point in the history
  • Loading branch information
JPMoresmau committed Jan 4, 2015
1 parent e148f72 commit 5555552
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -295,7 +295,7 @@ public static void deleteAllProblems(IProject p) {
/**
* cache project cabal file if cabal file doesn't have same name than project
*/
private static Map<IProject,IFile> m=new HashMap<>();
private static Map<IProject,IFile> cabalFileCache=new HashMap<>();

/**
* get the cabal file path
Expand Down Expand Up @@ -339,8 +339,8 @@ public static IPath getCabalFile(final IPath projectPath, final String name) {
public static IFile getCabalFile(final IProject project) {
IFile f=project.getFile(new Path(project.getName()).addFileExtension(FileUtil.EXTENSION_CABAL));
if (f==null || !f.exists()){ // oh oh
IFile f2=m.get(project);
if (f2==null){
IFile f2=cabalFileCache.get(project);
if (f2==null || !f2.exists()){
try {
// find a cabal file
IResource[] children=project.members();
Expand All @@ -359,7 +359,7 @@ public static IFile getCabalFile(final IProject project) {
// log error, we've taken a random cabal file
logError(NLS.bind(BWText.project_cabal_duplicate, project.getName()),null);
}
m.put(project, f);
cabalFileCache.put(project, f);
} catch (CoreException ce){
logError(NLS.bind(BWText.project_members_list_error, project.getName()), ce);
}
Expand Down

0 comments on commit 5555552

Please sign in to comment.