feat: add separate instances_dir config option#3
Merged
Conversation
Comment on lines
+15
to
+16
| if let Some(ref dir) = instances_dir_override | ||
| && !dir.exists() |
There was a problem hiding this comment.
validation happens before data_dir is validated in main.rs - if data_dir validation fails first, this error won't be shown
Suggested change
| if let Some(ref dir) = instances_dir_override | |
| && !dir.exists() | |
| if let Some(ref dir) = instances_dir_override { | |
| if !dir.exists() { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/data/config.rs
Line: 15-16
Comment:
validation happens before `data_dir` is validated in `main.rs` - if `data_dir` validation fails first, this error won't be shown
```suggestion
if let Some(ref dir) = instances_dir_override {
if !dir.exists() {
```
How can I resolve this? If you propose a fix, please make it concise.
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
instances_dirconfig option that lets users override the instances path independently ofdata_dir<data_dir>/instanceswhen unset; validates the path exists on startupTest plan
instances_dir— uses auto-detected data_dir but custom instances pathdata_dirandinstances_dir— each respected independentlyinstances_dirto nonexistent path — app shows errorcargo clippy -- -D warningspassescargo testpasses (15/15)Greptile Summary
Added a new
instances_dirconfig option that allows users to specify a custom location for Minecraft instances independent of the main PrismLauncherdata_dir. This is useful when instances are stored on a separate drive or non-standard location.Key changes:
instances_dirfield toAppConfigwith tilde expansion supportPrismConfig::load()to accept and validate the instances directory overrideinstances_dir()method to return the override path when set, otherwise falls back to<data_dir>/instancesConfidence Score: 5/5
Important Files Changed
instances_dirconfig option with clear explanations and examplesinstances_dirfield with tilde expansion support matchingdata_dirpatterninstances_diroverride with validation; stylistic preference for separate if statement instead of let-chaininstances_dirconfig parameter toPrismConfig::load()Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD Start[App Start] --> LoadAppConfig[Load AppConfig from config.toml] LoadAppConfig --> CheckDataDir{data_dir set?} CheckDataDir -->|Yes| ValidateDataDir[Validate data_dir exists] CheckDataDir -->|No| AutoDetect[Auto-detect PrismLauncher data_dir] ValidateDataDir --> DataDirOK[data_dir resolved] AutoDetect --> DataDirOK DataDirOK --> LoadPrismConfig[Load PrismConfig] LoadPrismConfig --> CheckInstancesDir{instances_dir set?} CheckInstancesDir -->|Yes| ValidateInstancesDir[Validate instances_dir exists] CheckInstancesDir -->|No| UseDefault[Use <data_dir>/instances] ValidateInstancesDir -->|Exists| InstancesDirOK[instances_dir resolved] ValidateInstancesDir -->|Not Found| Error1[Error: instances_dir not found] UseDefault --> InstancesDirOK InstancesDirOK --> AppReady[App Ready]Last reviewed commit: 6ef7df4