I'm writing an example filesystem plugin in Odin to help people use our programming language to write Total Commander plugins, and also to exercise our upcoming improved `core:os` replacement using a nice UI.
What it does so far:
- It reports its name (using `GetDefRootNameW`) as "Example Odin FS Plugin"
- `FsInitW` remembers the plugin number and callbacks
- `FsFindFirstW`, `FsFindNextW` and `FsFindClose` translate the WString <> utf8 and call our filesystem iterator, then translate back to the WString-based FindDataW.
- `FsGetFileW` and `FsGetFileW` work, updating the progress bar, supporting Overwrite if the destination exists
But now I'm running into what seems like a bug in `FsRenMovFileW`.
I use Shift-F6 to rename a file on the plugin FS, `FsRenMovFileW` is called with the old and new name, move and overwrite flags (and remote info).
So far, so good.
If the destination doesn't exist, e.g. LICENSE -> LICENSE.txt, then it renames no problem. `FsRenMovFileW` is called with `move` set to true.
Renaming back is also fine.
If however I have both LICENSE and LICENSE.txt and want to rename/move to overwrite the destination, `FsRenMovFileW` is still called with `move` set to true, however if I return `FS_FILE_EXISTS` as per the documentation, the user receives the following message:
Code: Select all
Error: Cannot write \\\Example Odin FS Plugin\LICENSE!
Please remove the write protection!
API is called, paths are translated to local path, and you can see I want to move LICENSE.txt to LICENSE
Code: Select all
[INFO ] --- [2025-05-03 16:01:01] [example_fs.odin:118:FsRenMovFileW()]
old_path: W:\Odin\LICENSE.txt
new_path: W:\Odin\LICENSE
move: true
overwrite: false
Code: Select all
[INFO ] --- [2025-05-03 16:01:01] [example_fs.odin:147:copy_or_move()]
src: W:\Odin\LICENSE.txt
dest: W:\Odin\LICENSE
flags: bit_set[Copy_Flag; i32]{Move}
mode: Internal
Code: Select all
[INFO ] --- [2025-05-03 16:01:01] [example_fs.odin:156:copy_or_move()] W:\Odin\LICENSE -> .Exists
Code: Select all
Total Commander usually calls this function twice:
- once with OverWrite==false. If the remote file exists, return FS_FILE_EXISTS. If it doesn't exist, try to copy the file, and return an appropriate error code.
- a second time with OverWrite==true, if the user chose to overwrite the file.
While copying the file, but at least at the beginning and the end, call ProgressProc to show the copy progress and allow the user to abort the operation.
Best regards,
Jeroen