1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-28 21:25:25 +00:00

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