clarify name handling

This commit is contained in:
vcoppe committed 2026-10-27 17:44:59 +01:00
1 parent 45f877ec78
commit 3f8e2a0c56
14 files changed
+204 -251

No files matched your search

+2 -1
View File
@@ -228,7 +228,8 @@ export async function createTauriBackend(): Promise<Backend> {
openUrl: (url) => invoke('open_url', { url }),
newFile: (name, folder, route) => invoke<Outcome>('new_file', { name, folder, route }),
createFolder: (parent, name) => invoke<string>('create_folder', { parent, name }),
renamePath: (path, name) => invoke<Outcome>('rename_path', { path, name }),
renamePath: (path, name) => invoke('rename_path', { path, name }),
renameFile: (fileId, name) => invoke<boolean>('rename_file', { fileId, name }),
movePaths: (paths, folder) => invoke('move_paths', { paths, folder }),
deletePaths: (paths) => invoke<Outcome>('delete_paths', { paths }),
revealPath: (path) => invoke('reveal_path', { path }),
+8 -3
View File
@@ -108,10 +108,15 @@ export interface DesktopFiles {
/** Makes a folder in a folder of the open folder (numbered if the name is taken): its path. */
createFolder(parent: string, name: string): Promise<string>;
/**
* Renames a file or a folder of the open folder. An open file is renamed like in its info (it
* is selected), which can be undone.
* Renames a file or a folder of the open folder, on the disk only (an open file keeps its name).
* Not undoable.
*/
renamePath(path: string, name: string): Promise<Outcome>;
renamePath(path: string, name: string): Promise<void>;
/**
* Renames the file on the disk of an open file, next to where it is; its name in the engine
* stays. Not undoable. False for a file that is not on the disk.
*/
renameFile(fileId: string, name: string): Promise<boolean>;
/** Moves files and folders of the open folder into a folder of it. */
movePaths(paths: string[], folder: string): Promise<void>;
/**
+14 -2
View File
@@ -626,9 +626,21 @@ class Engine {
.value;
}
/** Renames a file or a folder of the open folder. Resolves to whether it was done. */
/**
* Renames a file or a folder of the open folder, on the disk only: an open file keeps its name.
* Resolves to whether it was done.
*/
async renamePath(path: string, name: string): Promise<boolean> {
return this.desktopRun((b) => b.desktop!.renamePath(path, name), true);
return (await this.desktopCall((desktop) => desktop.renamePath(path, name), true)).done;
}
/**
* Renames the file on the disk of an open file (the desktop app), which is not undoable: its
* name in the engine stays (see `metadata`). Resolves to whether it was done; nothing is done
* for a file that is not on the disk.
*/
async renameFile(fileId: string, name: string): Promise<boolean> {
return (await this.desktopCall((desktop) => desktop.renameFile(fileId, name), true)).done;
}
/** Moves files and folders of the open folder into a folder of it. */