Skip to content

Commit f76c809

Browse files
committed
Fix workspace storage creation
Fixes #1308.
1 parent 4c6e4be commit f76c809

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ci/vscode.patch

+9-6
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,7 @@ index a1c3e50ffd..910627aaf9 100644
26762676
throw new Error(`Cannot load URI: '${module}', must be of file-scheme`);
26772677
}
26782678
diff --git a/src/vs/workbench/api/node/extHostStoragePaths.ts b/src/vs/workbench/api/node/extHostStoragePaths.ts
2679-
index afdd6bf398..604fdd255c 100644
2679+
index afdd6bf398..1633daf93d 100644
26802680
--- a/src/vs/workbench/api/node/extHostStoragePaths.ts
26812681
+++ b/src/vs/workbench/api/node/extHostStoragePaths.ts
26822682
@@ -5,13 +5,14 @@
@@ -2704,18 +2704,20 @@ index afdd6bf398..604fdd255c 100644
27042704
) {
27052705
this._workspace = withNullAsUndefined(initData.workspace);
27062706
this._environment = initData.environment;
2707-
@@ -54,21 +56,25 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths {
2707+
@@ -54,21 +56,26 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths {
27082708
const storageName = this._workspace.id;
27092709
const storagePath = path.join(this._environment.appSettingsHome.fsPath, 'workspaceStorage', storageName);
27102710

27112711
- const exists = await pfs.dirExists(storagePath);
2712+
-
2713+
- if (exists) {
27122714
+ // NOTE@coder: Use the file system proxy so this will work in the browser.
2713-
+ // writeFile performs a mkdirp so we don't need to bother ourselves.
27142715
+ const fileSystem = this._extHostRpc.getProxy(MainContext.MainThreadFileSystem);
2715-
+ const exists = fileSystem.$stat(URI.file(storagePath));
2716-
2717-
if (exists) {
2716+
+ try {
2717+
+ await fileSystem.$stat(URI.file(storagePath));
27182718
return storagePath;
2719+
+ } catch (error) {
2720+
+ // Doesn't exist.
27192721
}
27202722

27212723
try {
@@ -2727,6 +2729,7 @@ index afdd6bf398..604fdd255c 100644
27272729
- configuration: this._workspace.configuration && URI.revive(this._workspace.configuration).toString(),
27282730
- name: this._workspace.name
27292731
- }, undefined, 2)
2732+
+ // NOTE@coder: $writeFile performs a mkdirp.
27302733
+ await fileSystem.$writeFile(
27312734
+ URI.file(path.join(storagePath, 'meta.json')),
27322735
+ VSBuffer.fromString(

0 commit comments

Comments
 (0)