Repository navigation
fix: stop recreating the default jobs folder after relocation (#403 part 2) - #410
Merged
Merged
Conversation
…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.
2 of 3 tasks
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/Documents/StemDeck/jobson every startup even when the library has been relocated elsewhere via Settings.documents_dir_for_jobs()indesktop/src-tauri/src/main.rseagerlycreate_dir_all'd the Documents default just to compute the value passed to the backend asSTEMDECK_DEFAULT_JOBS_DIR- a fallback, not a pin. The Python side (app/core/config.py'sensure_runtime_dirs) already creates whicheverJOBS_DIRactually wins the settings precedence, so eagerly creating the unused default on the Rust side was pure side effect with no purpose.documents_stemdeck_dir()anddocuments_dir_for_jobs()now only compute paths, never create directories. The one real use site (documents_store_path(), which is about to read/writeuser-data.jsonin whichever folder is actually current) already callscreate_dir_allitself right after resolving the path, so behavior there is unchanged.Test plan
cargo clippy --all-targetsclean (3 pre-existing, unrelated warnings)cargo test- 33/33 pass~/Documents/StemDeck/jobsis no longer recreated