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
+15
View File
@@ -214,6 +214,21 @@ proxifly-запись с `"protocol": "https"` — это всё равно HTTP
десяти адресам, занимает место один раз. Провенанс (откуда, когда, каким прогоном, через какую
прокси) пишется отдельно.
### Где всё лежит
**Собранное — рядом с приложением**, в папке `media` возле исполняемого файла: коллекция и есть
смысл программы, она растёт без предела, и копирование папки должно уносить архив с собой. Каталог
меняется в настройках (кнопка «Выбрать…»), применяется после перезапуска — пути разбираются один
раз, до того как собран контейнер, и писать не туда, куда показывает поле, было бы хуже, чем
попросить перезапуск. Существующие файлы при смене **не переносятся**.
Если папка рядом с exe недоступна для записи — установка в Program Files, монтирование только для
чтения — происходит откат в профиль пользователя. Действующий путь всегда виден в настройках, так
что откат заметен, а не загадочен.
Настройки, логи и состояние прокси остаются в профиле (`%APPDATA%/AvParser`,
`~/.config/AvParser`): это конфигурация, она пользовательская и лежит там, где положено по правилам ОС.
### Витрина
`blobs/ab/cd/<sha256>.png` не годится для просмотра глазами, поэтому рядом строится