From b20f7c072edacee44639f69ecd3ff1881ecab325 Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Mon, 22 Jul 2024 12:56:16 +0200 Subject: [PATCH] add method to move file --- src/Model/Global/storageModel.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Model/Global/storageModel.ts b/src/Model/Global/storageModel.ts index b5ba4f7e..c3c97fa9 100644 --- a/src/Model/Global/storageModel.ts +++ b/src/Model/Global/storageModel.ts @@ -71,6 +71,15 @@ export default class StorageModel { return [...Object.keys(currentParent).sort(localeCompare)]; }; + rename = (sourcePathComponents: string[], destinationPathComponents: string[]): boolean => { + const content: string|null = this.read(sourcePathComponents); + if (content == null) return false; + + this.write(destinationPathComponents, content); + this.remove(sourcePathComponents); + return true; + } + // stringifiable writeStringifiable = (pathComponents: string[], value: ValidObject): void => { const valueString: string = stringify(value); @@ -89,6 +98,7 @@ export default class StorageModel { return object; }; + // tree initializeTree = (): void => {