Keep collected media beside the executable, and let it be moved

Two things were wrong with where media lived. It defaulted to the user profile,
which is the wrong home for the thing the application exists to accumulate: the
collection grows without bound and belongs with the installation, so copying
that folder takes the archive with it. And the setting for changing it existed
but had no way to be set - the Settings page showed the path as read-only text.

Media now defaults to a "media" folder next to the executable, and the Settings
page has a box, a folder picker and a reset. Configuration stays in the profile,
because that is genuinely per-user and the OS has an opinion about it.

Writability is probed with a real file, not just a directory creation: creating
a directory can succeed where writing into it does not, which is exactly what an
install under Program Files looks like. On failure it falls back to the profile
rather than refusing to start, and the effective path is shown in Settings so
the fallback is visible instead of mysterious.

A change applies on the next launch and says so. Paths are resolved before the
container exists - the media root is read straight out of settings.json to build
them - so applying it live would mean reconnecting the index, the blob store and
the thumbnail cache underneath a possibly-running collection. Writing somewhere
other than the box claims would be the worse failure. Existing files are not
moved either; relocating an archive is its own operation with its own risks.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-08-14 07:53:42 +03:00
co-authored by Claude Opus 5
parent ceacec79e2
commit a4a0ea9a6b
11 changed files with 484 additions and 13 deletions
+11
View File
@@ -241,6 +241,17 @@ throttle 250 мс — пул дёргается на каждый исход л
свежая CVE не роняла сборку кода, который никто не трогал.
- Тестовые послабления анализаторов — в `tests/Directory.Build.props`, не в самих тестах.
## Пути
- **Медиа лежит рядом с exe, настройки — в профиле.** Это осознанное расхождение: конфигурация
пользовательская, а коллекция принадлежит установке и переезжает вместе с папкой.
- **`DefaultMediaDirectory()` проверяет запись пробным файлом**, а не только созданием каталога:
каталог создаётся и там, куда потом нельзя записать. При отказе — откат в профиль.
- **Смена каталога требует перезапуска.** `AppPaths` строится до контейнера (медиа-корень читается
из settings.json напрямую), так что применить его на лету нельзя без переподключения индекса,
blob-хранилища и кэша миниатюр. Настройки честно это говорят и показывают действующий путь.
- **Смена каталога не переносит файлы.** Перенос архива — отдельная операция с другой ценой ошибки.
## Отображение медиа
- **Миниатюры декодируются в нужную ширину**, а не декодируются целиком и потом масштабируются.