Expand description
The OS-specific half of the Files pane’s filesystem layer: path display form, hidden attributes, a rename that never overwrites, a delete that never follows a link, and the commands that open or reveal a path.
Deliberately depends on nothing but std, libc and windows-sys, so
every cfg arm can be checked on its own.
Spec: docs/specs/SPEC_FILE_BROWSER_PANE_2026_10_01.md §9.
Functions§
- create_
symlink - Create a symlink at
linkpointing attarget, of the same kind as the link being copied (like, its own file type). Windows has separate file and directory links; a junction is recreated as a directory link. - display_
path pathas the frontend should see it. On Windows,canonicalizereturns verbatim paths (\\?\C:\…,\\?\UNC\host\share\…); those are turned back into their ordinary forms. Elsewhere the path is unchanged.- explorer_
quote explorer.exe’s argument fordisplay. Windows paths can’t contain", so quoting is unambiguous, and it keeps a path with spaces or commas in one piece. A trailing backslash would escape the closing quote, so it is trimmed; a drive root (C:\) has no spaces and goes unquoted.- has_
hidden_ attribute - Whether
meta(the entry’s own metadata, not a link’s target) carries the hidden or system attribute. Always false off Windows, where hidden means only a leading dot. - is_
os_ blocked - Whether an access error is macOS’s privacy system (TCC) refusing, rather
than ordinary permissions: TCC denials are
EPERM, ordinary onesEACCES(spec §9.1.1 fact 2). Rust maps both toPermissionDenied, so the raw code decides. - is_
symlink_ privilege_ error - Whether creating a symlink failed because Windows requires Developer
Mode or elevation for it (
ERROR_PRIVILEGE_NOT_HELD). - open_
command - The command that opens
pathwith the OS default application, forspawn_detached(which sanitizes its environment). - open_
no_ follow - Open
pathfor reading, refusing a symlink where the OS can: a copy reads the file that was listed, never what a link swapped in since points at (spec §9: never follow a link when copying). - remove_
entry_ no_ follow - Permanently remove the entry at
pathwithout following it: a symlink (or Windows junction) is unlinked and its target kept, a directory is removed with its contents, anything else is removed as a file. - remove_
file_ force - Remove the regular file at
path. On Windows a read-only file refuses deletion, so the attribute is cleared first when that is the refusal: a moved file’s original and a discarded partial copy both have to go. - rename_
checked 🔒 - Check-then-rename, for filesystems with no atomic no-replace rename.
symlink_metadatarather thanexists, so a dangling link attostill counts as taken. - rename_
no_ replace - Rename
fromtoto, failing withAlreadyExistsinstead of replacing an existingto. - reveal_
command - The command that shows
pathselected in the OS file manager. Linux has no portable “select”, so it opens the containing folder. - spawn_
detached - Spawn
cmddetached from srv’s own stdio, and reap it on a thread. - strip_
verbatim - The string half of
display_path, separate so it can be tested on any platform. Only the drive and UNC forms are rewritten; any other verbatim path (\\?\Volume{…}\) has no ordinary spelling and is left alone. - trash_
unavailable_ reason - Why
pathcan’t go to the Recycle Bin, if it can’t.