Repository navigation
Description
Problem (today, on one machine)
Every library photo stores an absolute path (Source::File { path }). When a disk or folder turns up somewhere else, every photo under it goes missing:
- a USB disk or NAS comes back at a new drive letter or mount point (
D:→E:,/Volumes/tokyo→/Volumes/tokyo 1,/media/me/usb→/run/media/me/usb): Find Missing has to find every photo again, by name, size and content hash; - the same disk written two ways shows as two disks (
/Volumes/tokyoand/Volumes/TOKYO, LRC-LIB-LIBFOLDERS Limits); - a folder moved outside LightCraft loses its colour label: Find Missing relinks photos but not folder records (same Limits);
- The [Synchronize Folder] dialog should provide an option to locate the new path if folder is missing #1112: Synchronize Folder on a missing folder has no way to say where it went.
Lightroom Classic's answer is Update Folder Location / Find Missing Folder on a folder row: one change and everything under it follows. This issue proposes the same thing for LightCraft.
It's useful today, on a single machine, without any sync. It's also the per-device path mapping that multi-machine libraries (#294, #880) will need later, but nothing here depends on that plan or builds towards a sync format (no device ids, no clocks). It isn't a #641-style step that has no use yet.
Design
Roots. The catalog keeps a table of roots, Root { id, path, volume_name? }. A photo's location becomes (root, relative path). A root's path is where it is on this machine; volume_name (the mount or volume label as seen at import) is only kept for a later "this disk is back at E:" prompt.
- On import, a photo goes under the deepest existing root that contains it; otherwise a new root is made at its disk (
folders::volume_of:D:,//server/share,/Volumes/tokyo,/media/me/usb…). On the startup disk the root is/(orC:), until someone moves a folder there (below). - The web build keeps one root for its OPFS storage. Local browse records (not library photos) stay on absolute paths.
One function. The only place that turns a location into a path is Catalog::file_path(&Photo) -> Option<PathBuf> (root.path + relative, joined with the separators the root uses). The engine, UI, web and CLI call it and never join paths themselves.
Ops.
AddRoot { root }/RemoveRoot: made automatically on import and when a folder needs a root of its own.SetRootPath { root, path }: one undo step; its inverse is the old path. Every photo under the root follows, and so do its folder records (colour labels), smart-album folder rules and the shownlibraryFoldersource, because they're stored root-relative too. Nothing is rewritten photo by photo, so it's O(1) whatever the root holds.- Moving a folder that isn't a root (e.g.
~/Pictures/2019moved on the startup disk): oneBatchsplits off a new root at that folder (re-homing the photos and folder records under it) and then sets its path. It's still one undo step. - Moving a root onto an existing root's path (the
tokyo/TOKYOcase) merges the two, also one step and undoable. Paths are still compared as written. Case-folding stays with the OS (Windows folds case); merging is something the user chooses. Op::Relink,Op::SetFile, rename and Convert to DNG keep taking absolute paths. The catalog maps them into(root, relative)when it applies them, so engine call sites and the ops already in logs don't change shape.
Commands (everything is a command): folder.updateLocation { folder, path } (works on any folder or disk row; the folder or disk need not be mounted now) and library.roots (list roots with their paths and whether each is there). They come with menu entries:
- Update Folder Location… on folder and disk rows in the sidebar's Folders section;
- Find Missing Folder… on rows whose folder is missing, in Missing Photos and in Synchronize Folder's "folder isn't there" result (The [Synchronize Folder] dialog should provide an option to locate the new path if folder is missing #1112).
MCP and CLI get these through the same ids.
Older libraries (format)
- Loading a v7 (or older) library works unchanged. Old records spell
Source::Fileas{ "path": … }, which still deserializes. When such a photo or op is applied, its absolute path goes through the import rule above (the deepest root, or a new disk root). Replay is deterministic (root ids are allocated in op order), so the same log always gives the same roots. Journal::openalready writes a snapshot in the newest format straight after loading an older one. That snapshot holds the roots and relative paths, so the conversion happens once and is durable. Older builds then refuse the library as "newer", as they do for every format bump.- Tests: load a v7 fixture and check that every photo's
file_pathis byte-for-byte the absolute path it had; a round-trip of the new format; a root move with undo and redo; a case-only rename; Windows forms (drive letters,\\server\share,\\?\and\\?\UNC\); macOS/Volumes; non-UTF-8 and hostile paths never panic. - Version number: this takes the next free row when it lands. 8 and 9 are already claimed by open PRs (Catalog: the log is compacted by the snapshot's size, not every 2000 records #800, LR-IMP-FORMATS: recheck stale preview-only raws when a library opens (#662) #974 and Catalog: the snapshot in segments of about 2 MB and at most 4096 photos (format 11, stacked on #800) #814, with Catalog: segments of about 2 MB and at most 4096 photos (stacked on #814) #846/Catalog: settings saved as
{}are not read, and a library's own defaults are read over (stacked on #814) #823/Catalog: back up the library to a dated folder that shares unchanged files (stacked on #2985) #841/Catalog: restore from the File menu, with the backup copied in the background (stacked on #856) #870/Catalog: restore a library from a backup, and keep what it replaces (stacked on #841) #856 stacked on Catalog: the snapshot in segments of about 2 MB and at most 4096 photos (format 11, stacked on #800) #814), so at least 10. I'll rebase onto nledford'sFORMATStable if it has merged by then, rather than race it.
Plan: small PRs, each useful and green on its own
- One path function, no format change. Add
Catalog::file_pathand move the ~98 non-test reads ofSource::File { path }(~35 files:rename.rs,import.rs,cmd/convert.rs,media.rs,wire.rs…) onto it. The behaviour is identical. This keeps the format PR small and stops new code from joining paths. - Catalog roots: the root table,
(root, relative)storage, loading older logs, format bump, the tests above. The behaviour is still identical. SetRootPath+folder.updateLocation+library.roots, with undo; folder records, smart-album folder rules and the shown folder follow. Update the LRC-LIB-LIBFOLDERS / LRC-LIB-MISSING Limits, add a checklist row for Update Folder Location, and updatedocs/gaps.md/whats-new.md.- UI: the menu entries, Missing Photos and the Synchronize Folder hook (The [Synchronize Folder] dialog should provide an option to locate the new path if folder is missing #1112), checked by screenshots through the control channel.
- (Optional, later) when a root is missing and a mounted disk has the same volume name, offer "tokyo is now at E:\ — update?". This only ever asks; it never relinks by itself.
Questions for @bflatastic / @echelon
- Go-ahead for this direction, starting with PR 0?
- Should roots default to the disk (as above, like Lightroom's top-level folders) or to the import folder? The disk keeps the root table small and makes a moved drive one action. Folder moves are covered by splitting a root on demand.
- Fine to wait on the format number until Catalog: the log is compacted by the snapshot's size, not every 2000 records #800/Catalog: the snapshot in segments of about 2 MB and at most 4096 photos (format 11, stacked on #800) #814 settle, or would you rather this went before them?
Related: #294, #880 (later users of the same mapping), #1112, #641 (held; this doesn't touch ids), #667 (Lightroom catalog import already finds moved .lrcat root folders; those root folders could become LightCraft roots directly).
Activity
mattsivak commentedon Oct 11, 2026
First step is up as a draft: #1121 (
folder.updateLocation, engine + tests + docs). While writing it, I found that the existing relink + folder-record machinery (what Rename / Move Folder use) already gives the user-visible result, so this step needs no new op and no catalog format change. It can't collide with #800 / #814 / #974. The root table in the proposal above can come later if you want it for #880 or for compact whole-disk moves. The sidebar entries (Update Folder Location…, and Find Missing Folder… from Synchronize, #1112) follow in a stacked PR.nledford commentedon Oct 11, 2026
I had #1112 in progress when this was posted, so there is now a PR for the user-facing half without a format change: #1122.
It does what steps 2 and 3 here describe, by relinking photo by photo in one undo step instead of moving a root:
folder.updateLocation {folder, path}(plusdisk?andincomplete?), so roots can replace the implementation under it later without changing what agents call. It has nolibrary.roots.folder_rest), so aD:\Photos\…catalog is located on Linux and macOS.Two things in it that I think roots would still need on top:
It doesn't touch how paths are stored, so it shouldn't get in the way of your PR 0 or 1. If you'd rather it were shaped differently so that roots slot in more easily (the command's result, the
FolderMove { on_disk }flag on the undo step), say so on #1122.LRC-LIB-LIBFOLDERS: a folder that is somewhere else now can be located (
LRC-LIB-LIBFOLDERS: a folder that is somewhere else now can be located (
LRC-LIB-LIBFOLDERS: a folder that is somewhere else now can be located (
LRC-LIB-LIBFOLDERS: a folder that is somewhere else now can be located (
Eliksir67 commentedon Nov 8, 2026
A related case at catalog import, in case it is useful here.
Investigated and written with Claude Code.
A Lightroom catalog made on Windows records its originals under
E:/Raw/. Imported on Linux, where the same originals are on a NAS share mounted at another path, every photo of that root folder comes in missing: about 75,000 originals for one catalog. Finding them afterwards with Find Missing Photos would mean reading every file again over the network, although the import had just been through the same catalog and could have read them in place.Would it make sense to let the new location of each root folder be given while the catalog is imported, before its originals are read, perhaps alongside the review of network sources in #3725? Update Folder Location would still cover a folder that moves later, but at import the photos would be linked from the start.
Thx a lot.