The context use command writes to ~/.iggy/.active_context via tokio::fs::write, which fails if the ~/.iggy/ directory hasn't been created yet.
The recently added context create command handles this by calling ensure_iggy_home_exists() before writing, but the existing write_active_context() and write_contexts() methods in ContextReaderWriter don't do this.
Steps to reproduce:
- Remove
~/.iggy/ if it exists
- Run
iggy context use default
- Observe a write error because the directory is missing
Fix would be to call ensure_iggy_home_exists() inside write_active_context() and write_contexts() so all write paths handle a fresh system.
Please wait before #2998 merges to work on this.
The
context usecommand writes to~/.iggy/.active_contextviatokio::fs::write, which fails if the~/.iggy/directory hasn't been created yet.The recently added
context createcommand handles this by callingensure_iggy_home_exists()before writing, but the existingwrite_active_context()andwrite_contexts()methods inContextReaderWriterdon't do this.Steps to reproduce:
~/.iggy/if it existsiggy context use defaultFix would be to call
ensure_iggy_home_exists()insidewrite_active_context()andwrite_contexts()so all write paths handle a fresh system.Please wait before #2998 merges to work on this.