Skip to content

fix: validate --app-config path early with clear error#77

Open
nanookclaw wants to merge 1 commit into
geoffjay:mainfrom
nanookclaw:fix/early-app-config-path-validation
Open

fix: validate --app-config path early with clear error#77
nanookclaw wants to merge 1 commit into
geoffjay:mainfrom
nanookclaw:fix/early-app-config-path-validation

Conversation

@nanookclaw
Copy link
Copy Markdown

Closes #42.

When an invalid --app-config (or NEMO_APP_CONFIG) path is passed, the failure currently surfaces deep in the loading pipeline as a generic IO error. This adds a targeted check in crates/nemo/src/main.rs right after Args::parse(), before runtime::NemoRuntime::new(...) and the GPUI early-runtime path, so the user sees what they actually passed.

Behavior:

  • Relative paths are resolved against std::env::current_dir() for the exists/is_file checks. If current_dir() fails the path is checked as supplied — the not-found error then reports the original path the user passed, never a canonicalized variant.
  • Non-existent paths are never canonicalized.
  • Error messages match the issue spec exactly:
    • Error: config file not found: <path>
    • Error: config path is not a file: <path>
    • followed by std::process::exit(1).

The existing if let Some(ref app_config) = args.app_config { ... headless/validate ... } block is left intact; the new block is additive and only changes behavior for paths that would have failed anyway.

Verified with cargo check -p nemo and cargo clippy -p nemo --no-deps (clean).

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.

Validate config file path early with proper errors

1 participant