add method to move file
This commit is contained in:
@@ -71,6 +71,15 @@ export default class StorageModel {
|
|||||||
return [...Object.keys(currentParent).sort(localeCompare)];
|
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
|
// stringifiable
|
||||||
writeStringifiable = (pathComponents: string[], value: ValidObject): void => {
|
writeStringifiable = (pathComponents: string[], value: ValidObject): void => {
|
||||||
const valueString: string = stringify(value);
|
const valueString: string = stringify(value);
|
||||||
@@ -89,6 +98,7 @@ export default class StorageModel {
|
|||||||
|
|
||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// tree
|
// tree
|
||||||
initializeTree = (): void => {
|
initializeTree = (): void => {
|
||||||
|
|||||||
Reference in New Issue
Block a user