Skip to content

Commit c677bf3

Browse files
committed
write meta.json file microsoft#41408
1 parent b4ee65d commit c677bf3

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

src/vs/workbench/api/node/extHostExtensionService.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { dispose } from 'vs/base/common/lifecycle';
88
import { join } from 'path';
9-
import { mkdirp, dirExists, realpath } from 'vs/base/node/pfs';
9+
import { mkdirp, dirExists, realpath, writeFile } from 'vs/base/node/pfs';
1010
import Severity from 'vs/base/common/severity';
1111
import { TPromise } from 'vs/base/common/winjs.base';
1212
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/node/extensionDescriptionRegistry';
@@ -88,24 +88,32 @@ class ExtensionStoragePath {
8888
return undefined;
8989
}
9090

91-
private _getOrCreateWorkspaceStoragePath(): TPromise<string> {
91+
private async _getOrCreateWorkspaceStoragePath(): TPromise<string> {
9292
if (!this._workspace) {
9393
return TPromise.as(undefined);
9494
}
95+
9596
const storageName = this._workspace.id;
9697
const storagePath = join(this._environment.appSettingsHome, 'workspaceStorage', storageName);
9798

98-
return dirExists(storagePath).then(exists => {
99-
if (exists) {
100-
return storagePath;
101-
}
99+
const exists = await dirExists(storagePath);
102100

103-
return mkdirp(storagePath).then(success => {
104-
return storagePath;
105-
}, err => {
106-
return undefined;
107-
});
108-
});
101+
if (exists) {
102+
return storagePath;
103+
}
104+
105+
try {
106+
await mkdirp(storagePath);
107+
await writeFile(
108+
join(storagePath, 'meta.json'),
109+
JSON.stringify({ id: this._workspace.id })
110+
);
111+
return storagePath;
112+
113+
} catch (e) {
114+
console.error(e);
115+
return undefined;
116+
}
109117
}
110118
}
111119

0 commit comments

Comments
 (0)