Fix storage path ending replacement
This commit is contained in:
parent
bc076ca30d
commit
227474c156
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user