Skip to content

Commit

Permalink
fix: #835 - Do not create a parent directory when checking if it exists.
Browse files Browse the repository at this point in the history
Fix is in TransactionalFileSystem.ts
  • Loading branch information
dsherret committed Jul 20, 2020
1 parent 00a16d0 commit 698a169
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/bootstrap/src/SourceFileCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export class SourceFileCache implements TsSourceFileContainer {
(sourceFile as any)["scriptKind"] as ts.ScriptKind,
);

this.fileSystemWrapper.queueMkdir(FileUtils.getDirPath(standardizedFilePath));
const dirPath = FileUtils.getDirPath(standardizedFilePath);
if (!this.fileSystemWrapper.directoryExistsSync(dirPath))
this.fileSystemWrapper.queueMkdir(dirPath);

this.sourceFilesByFilePath.set(standardizedFilePath, sourceFile);
}

Expand Down
4 changes: 3 additions & 1 deletion packages/common/src/fileSystem/TransactionalFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,9 @@ export class TransactionalFileSystem {
return pathDir.getIsDeleted();

// check if the provided path is a file or if it or its parent is deleted
const parentDir = this.getOrCreateParentDirectory(path);
const parentDir = this.getParentDirectoryIfExists(path);
if (parentDir == null)
return false;
return parentDir.isFileQueuedForDelete(path) || parentDir.getIsDeleted();
}

Expand Down

0 comments on commit 698a169

Please sign in to comment.