Archived
1
0

Fix storage path ending replacement

This commit is contained in:
Asher 2019-02-21 12:06:15 -06:00
parent bc076ca30d
commit 227474c156
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC

View File

@ -14,10 +14,11 @@ class StorageDatabase implements workspaceStorage.IStorageDatabase {
public readonly onDidChangeItemsExternal = Event.None; public readonly onDidChangeItemsExternal = Event.None;
private readonly items = new Map<string, string>(); private readonly items = new Map<string, string>();
private fetched: boolean = false; private fetched: boolean = false;
private readonly path: string;
public constructor(private readonly path: string) { public constructor(path: string) {
path = path.replace(/\.vscdb$/, ".json"); this.path = path.replace(/\.vscdb$/, ".json");
logger.debug("Setting up storage", field("path", path)); logger.debug("Setting up storage", field("path", this.path));
window.addEventListener("unload", () => { window.addEventListener("unload", () => {
if (!navigator.sendBeacon) { if (!navigator.sendBeacon) {
throw new Error("cannot save state"); throw new Error("cannot save state");
@ -39,7 +40,7 @@ class StorageDatabase implements workspaceStorage.IStorageDatabase {
this.items.set(key, json[key]); this.items.set(key, json[key]);
}); });
} catch (error) { } catch (error) {
if (error.code && error.code !== "ENOENT") { if (error.code !== "ENOENT") {
throw error; throw error;
} }
} }