add method to move file

This commit is contained in:
marlon-erler
2024-07-22 12:56:16 +02:00
parent 71281adbd0
commit b20f7c072e
+10
View File
@@ -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 => {