summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/database.ts b/src/database.ts
index 70aecf4..9ac31ea 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -53,9 +53,13 @@ export class Database implements DatabaseInterface {
}
async write(path: string, toWrite: any): Promise<void> {
- const pathParts = splitPath(path);
- const writeTo = this.resolve(pathParts, false, 1);
- writeTo[last(pathParts)] = toWrite;
+ if (path === "/") {
+ this.buff = toWrite;
+ } else {
+ const pathParts = splitPath(path);
+ const writeTo = this.resolve(pathParts, false, 1);
+ writeTo[last(pathParts)] = toWrite;
+ }
await this.serialize();
}