Refine layout config editing and add shared config-file helper #712
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.
Motivation
Description
src/common/config_files.rsprovidingConfigFileSpec,resolve_config_pathandensure_config_fileto resolve config paths relative to the settings file and create missing files with default templates, and include unit tests for the helper.set_settings_path/settings_pathinsrc/settings.rsand callset_settings_path("settings.json")at startup insrc/main.rsso helpers can resolve relative config locations.DEFAULT_LAYOUTS_TEMPLATEandLAYOUTS_CONFIGinsrc/plugins/layouts_storage.rs, exposelayouts_config_path()and updateload_layouts/save_layoutsto acceptPath-style arguments and ensure parent directories are created on save.src/actions/layout.rs,src/plugins/layout.rs, andsrc/dashboard/widgets/layouts.rsuseensure_config_fileto create templates when missing andopen::thatthe exact file path.Testing
src/common/config_files.rsand attempted to run them withcargo test config_files.alsa-sys(error: missingalsa.pc/alsasystem library), so the unit tests were not executed here; the helper tests are self-contained and should run when the environment can build all crates or when running the specific package tests without the system-dependent crates.Codex Task