Skip to content

fix: stop recreating the default jobs folder after relocation (#403 part 2) - #410

Merged
thcp merged 1 commit into
mainfrom
fix/403-default-jobs-dir-eager-create
Aug 21, 2026
Merged

thcp merged 1 commit into
mainfrom
fix/403-default-jobs-dir-eager-create

Conversation

@thcp

@thcp thcp commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Follow-up to [Bug]: #403: after both prior fixes shipped in 0.12.0, the reporter confirmed the relocated library metadata now moves correctly, but StemDeck still recreates ~/Documents/StemDeck/jobs on every startup even when the library has been relocated elsewhere via Settings.
  • Root cause: documents_dir_for_jobs() in desktop/src-tauri/src/main.rs eagerly create_dir_all'd the Documents default just to compute the value passed to the backend as STEMDECK_DEFAULT_JOBS_DIR - a fallback, not a pin. The Python side (app/core/config.py's ensure_runtime_dirs) already creates whichever JOBS_DIR actually wins the settings precedence, so eagerly creating the unused default on the Rust side was pure side effect with no purpose.
  • Fix: documents_stemdeck_dir() and documents_dir_for_jobs() now only compute paths, never create directories. The one real use site (documents_store_path(), which is about to read/write user-data.json in whichever folder is actually current) already calls create_dir_all itself right after resolving the path, so behavior there is unchanged.

Test plan

  • cargo clippy --all-targets clean (3 pre-existing, unrelated warnings)
  • cargo test - 33/33 pass
  • CI green
  • Manual: relocate stems folder via Settings, restart, confirm ~/Documents/StemDeck/jobs is no longer recreated

…art 2)

documents_dir_for_jobs() eagerly created ~/Documents/StemDeck/jobs on every
startup just to compute the value handed to the backend as
STEMDECK_DEFAULT_JOBS_DIR, even when the user had already relocated their
library elsewhere via Settings and this default is never used. The Python
side (app/core/config.py's ensure_runtime_dirs) already creates whichever
JOBS_DIR actually wins that precedence, so the Rust side only needs to
compute the path, not create it.
@thcp
thcp merged commit abf09ab into main Aug 21, 2026
10 checks passed
@thcp
thcp deleted the fix/403-default-jobs-dir-eager-create branch August 21, 2026 21:12
thcp added a commit that referenced this pull request Aug 21, 2026
…411)

## Summary
Stacked on #410 (needs that merged first, or the diff below will include
its commit too).

- Windows portable builds already keep `cache`/`models`/`settings.json`
inside the package next to `StemDeck.exe`, via `local_data_dir()`'s
portable redirect (#399). The jobs default never plugged into that and
always resolved to `~/Documents/StemDeck/jobs` regardless of
portable-ness.
- `documents_dir_for_jobs()` now defaults **new** portable installs to
`local_data_dir()/jobs` (i.e. `<exe dir>/data/jobs`), consistent with
cache/models.
- **Existing installs are unaffected.** If `~/Documents/StemDeck/jobs`
already has anything in it, that stays the resolved default - checked
directly against disk content rather than a migration flag, since
there's no explicit `jobs_dir` recorded in `settings.json` for an
implicit default, and only the Python backend writes that file (kept
this self-contained rather than crossing that boundary).
- Non-portable installs (installer builds, macOS, Linux) are untouched
either way - the original Documents rationale (visible in
Finder/Explorer, OneDrive/iCloud backup, survives reinstalls) still
applies to them.
- Manual relocation via Settings still overrides everything, unchanged.

## Test plan
- [x] `cargo clippy --all-targets` clean (3 pre-existing, unrelated
warnings)
- [x] `cargo test` - 36/36 pass (3 new tests for
`directory_has_entries`)
- [ ] CI green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant