fix: cross-platform compatibility for Windows support

- Use directories::BaseDirs for config path fallback instead of hardcoded Unix path
- Default to notepad on Windows instead of vi for editor commands
- Skip +N line argument for notepad in todo edit (notepad doesn't support it)
This commit is contained in:
Konstantin Fickel 2026-04-07 13:49:12 +02:00 committed by kfickel
parent 10f4ae282a
commit 4ded06748b
4 changed files with 29 additions and 9 deletions

View file

@ -24,7 +24,13 @@ pub fn run() -> Result<(), StreamdError> {
drop(file);
// Open in editor
let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string());
let editor = std::env::var("EDITOR").unwrap_or_else(|_| {
if cfg!(windows) {
"notepad".to_string()
} else {
"vi".to_string()
}
});
let status = Command::new(&editor).arg(&preliminary_path).status()?;
if !status.success() {