NonProjectFileWritingAccessProvider — do not use Project.DIRECTORY_STORE_FOLDER

This commit is contained in:
Vladimir Krivosheev
2016-09-20 13:02:41 +02:00
parent 1d5c36b1ce
commit 8a03f8cccc
2 changed files with 4 additions and 10 deletions
@@ -226,7 +226,7 @@ abstract class ProjectStoreBase(override final val project: ProjectImpl) : Compo
val filePath = file.path
if (!isDirectoryBased) {
return filePath == projectFilePath
return filePath == projectFilePath || filePath == workspaceFilePath
}
return FileUtil.isAncestor(PathUtilRt.getParentPath(projectFilePath), filePath, false)
}
@@ -150,17 +150,11 @@ public class NonProjectFileWritingAccessProvider extends WritingAccessProvider {
if (!Registry.is("ide.hide.excluded.files") && fileIndex.isExcluded(file) && !fileIndex.isUnderIgnored(file)) return true;
if (project instanceof ProjectEx && !project.isDefault()) {
if (ProjectKt.isDirectoryBased(project)) {
VirtualFile baseDir = project.getBaseDir();
VirtualFile dotIdea = baseDir == null ? null : baseDir.findChild(Project.DIRECTORY_STORE_FOLDER);
if (dotIdea != null && VfsUtilCore.isAncestor(dotIdea, file, false)) return true;
}
IProjectStore store = ProjectKt.getStateStore(project);
String filePath = file.getPath();
if (FileUtil.namesEqual(filePath, store.getWorkspaceFilePath()) || FileUtil.namesEqual(filePath, store.getProjectFilePath())) {
if (ProjectKt.getStateStore(project).isProjectFile(file)) {
return true;
}
String filePath = file.getPath();
for (Module module : ModuleManager.getInstance(project).getModules()) {
if (FileUtil.namesEqual(filePath, module.getModuleFilePath())) {
return true;