Skip to content

Commit 2c18fb8

Browse files
committed
FileSystemResourceManager: Create project directory before .project file
Follow-up on #1446 to avoid mkdir()-retry and minimize incompatibility with non-standard IFileSystem implementations.
1 parent 29d6edf commit 2c18fb8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,15 @@ public boolean internalWrite(IProject target, IProjectDescription description, i
697697
byte[] newContents = out.toByteArray();
698698

699699
//write the contents to the IFile that represents the description
700-
if (!descriptionFile.exists())
700+
if (!descriptionFile.exists()) {
701+
// When creating a new .project file, explicitly ensure the project directory
702+
// exists. Since https://github.com/eclipse-platform/eclipse.platform/pull/1446
703+
// write() initially assumes that parent directories already exist (in order to
704+
// optimize the most likely use-cases) and then falls back to mkdir() + retry if
705+
// this is not the case. We can avoid this retry.
706+
getStore(target).mkdir(EFS.NONE, null);
701707
workspace.createResource(descriptionFile, false);
702-
else {
708+
} else {
703709
//if the description has not changed, don't write anything
704710
if (!descriptionChanged(descriptionFile, newContents))
705711
return false;

0 commit comments

Comments
 (0)