summaryrefslogtreecommitdiff
path: root/frontend/lib/drive_server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/lib/drive_server.ts')
-rw-r--r--frontend/lib/drive_server.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/frontend/lib/drive_server.ts b/frontend/lib/drive_server.ts
index 992a287..2a94fe9 100644
--- a/frontend/lib/drive_server.ts
+++ b/frontend/lib/drive_server.ts
@@ -97,6 +97,17 @@ export async function Drive_mkdir(path: string, email: string) {
97 } 97 }
98} 98}
99 99
100/// renames a file or directory from old path to new path
101export async function Drive_rename(oldPath: string, newPath: string, email: string) {
102 const result = spawnSync('fctdrive', ['rename', '--email', email, '--old', oldPath, '--new', newPath], { encoding: 'utf-8' });
103 if (result.error) {
104 throw new Error(`Failed to execute fctdrive: ${result.error.message}`);
105 }
106 if (result.status !== 0) {
107 throw new Error(`fctdrive exited with code ${result.status}: ${result.stderr}`);
108 }
109}
110
100/// builds a filesystem tree from Drive_ls entries 111/// builds a filesystem tree from Drive_ls entries
101export async function Drive_tree(): Promise<DriveTreeResponse> { 112export async function Drive_tree(): Promise<DriveTreeResponse> {
102 const entries = await Drive_ls('/', true); 113 const entries = await Drive_ls('/', true);