Skip to content

feat: add separate instances_dir config option#3

Merged
OneNoted merged 2 commits intomainfrom
feat/instances-dir
Feb 19, 2026
Merged

feat: add separate instances_dir config option#3
OneNoted merged 2 commits intomainfrom
feat/instances-dir

Conversation

@OneNoted
Copy link
Owner

@OneNoted OneNoted commented Feb 19, 2026

Summary

  • Adds a new instances_dir config option that lets users override the instances path independently of data_dir
  • Useful when instances live on a separate drive or non-standard location
  • Falls back to <data_dir>/instances when unset; validates the path exists on startup
  • Documents the new option in the README

Test plan

  • Run without either option set — auto-detection unchanged
  • Set only instances_dir — uses auto-detected data_dir but custom instances path
  • Set both data_dir and instances_dir — each respected independently
  • Set instances_dir to nonexistent path — app shows error
  • cargo clippy -- -D warnings passes
  • cargo test passes (15/15)

Greptile Summary

Added a new instances_dir config option that allows users to specify a custom location for Minecraft instances independent of the main PrismLauncher data_dir. This is useful when instances are stored on a separate drive or non-standard location.

Key changes:

  • Added instances_dir field to AppConfig with tilde expansion support
  • Modified PrismConfig::load() to accept and validate the instances directory override
  • Updated instances_dir() method to return the override path when set, otherwise falls back to <data_dir>/instances
  • Validated that the instances directory exists during config load, returning an error if not
  • Documented the new option in README with clear examples

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean implementation following existing patterns, proper validation added, well-documented, and author reports tests pass
  • No files require special attention

Important Files Changed

Filename Overview
README.md documented new instances_dir config option with clear explanations and examples
src/data/app_config.rs added instances_dir field with tilde expansion support matching data_dir pattern
src/data/config.rs implemented instances_dir override with validation; stylistic preference for separate if statement instead of let-chain
src/main.rs wired up instances_dir config parameter to PrismConfig::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 &lt;data_dir&gt;/instances]
    ValidateInstancesDir -->|Exists| InstancesDirOK[instances_dir resolved]
    ValidateInstancesDir -->|Not Found| Error1[Error: instances_dir not found]
    UseDefault --> InstancesDirOK
    InstancesDirOK --> AppReady[App Ready]
Loading

Last reviewed commit: 6ef7df4

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +15 to +16
if let Some(ref dir) = instances_dir_override
&& !dir.exists()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@OneNoted OneNoted merged commit 7625f09 into main Feb 19, 2026
13 checks passed
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