Add data_dir config option for custom PrismLauncher directory#2
Merged
Add data_dir config option for custom PrismLauncher directory#2
Conversation
16cf1d8 to
73b75fe
Compare
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
data_diroption to~/.config/prism-tui/config.tomlfor users with non-standard PrismLauncher installations (portable installs, custom paths)~/,~\) on all platformsChanges
src/data/app_config.rs— Addeddata_dir: Option<String>field,resolved_data_dir()method, andexpand_tilde()helpersrc/data/config.rs—find_prism_data_dir()now accepts a config override with priority: env var > config file > platform default > Flatpak. Both env var and config error explicitly on missing pathssrc/main.rs— LoadAppConfigbefore data dir detection and pass it throughsrc/app.rs—App::new()acceptsAppConfigparameter instead of loading it internallyREADME.md— Document config file location,data_diroption, and data directory detection orderExample Config
Test plan
cargo build— no warningsdata_dirset — existing auto-detection works unchangeddata_dir = "/some/valid/path"to config — app uses that pathdata_dir = "/nonexistent"— app shows config errordata_dir— env var winsGreptile Summary
Added configurable
data_diroption to support non-standard PrismLauncher installations (portable installs, custom paths). The implementation follows a clear priority chain: environment variable > config file > platform default > Flatpak location.Key improvements:
~/,~\) works cross-platform viaexpand_tilde()helper insrc/data/app_config.rs:86main.rsto pass resolved path through initialization chainApp::new()signature changed to acceptAppConfigparameter for cleaner dependency flowConfidence Score: 5/5
Important Files Changed
data_dirfield with tilde expansion viaexpand_tilde()helper andresolved_data_dir()methodfind_prism_data_dir()to accept config override with explicit error handling for missing pathsAppConfigbefore data dir detection and passes resolved path tofind_prism_data_dir()App::new()to acceptAppConfigparameter instead of loading internallydata_diroption, and data directory detection priority orderFlowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Start: main.rs] --> B[Load AppConfig] B --> C[Call resolved_data_dir] C --> D[expand_tilde on data_dir if set] D --> E[find_prism_data_dir] E --> F{PRISMLAUNCHER_DATA<br/>env var set?} F -->|Yes| G{Path exists?} G -->|Yes| H[Return env var path] G -->|No| I[Error: env var<br/>path not found] F -->|No| J{Config data_dir<br/>provided?} J -->|Yes| K{Path exists?} K -->|Yes| L[Return config path] K -->|No| M[Error: config<br/>path not found] J -->|No| N{Standard platform<br/>path exists?} N -->|Yes| O[Return standard path] N -->|No| P{Flatpak path<br/>exists? Linux only} P -->|Yes| Q[Return Flatpak path] P -->|No| R[Error: DataDirNotFound] H --> S[Initialize App] L --> S O --> S Q --> SLast reviewed commit: 73b75fe