feat: add Windows build support and release artifacts #83

Merged
kfickel merged 2 commits from 80_windows-build-support into main 2026-04-13 19:53:49 +02:00
4 changed files with 29 additions and 9 deletions
Showing only changes of commit a5d143758a - Show all commits

View file

@ -44,7 +44,13 @@ pub fn run(number: i32) -> Result<(), StreamdError> {
}; };
if let Some(file_path) = sorted_shards[selected_index].location.get("file") { if let Some(file_path) = sorted_shards[selected_index].location.get("file") {
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()
}
});
Command::new(&editor).arg(file_path).status()?; Command::new(&editor).arg(file_path).status()?;
} }

View file

@ -24,7 +24,13 @@ pub fn run() -> Result<(), StreamdError> {
drop(file); drop(file);
// Open in editor // 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()?; let status = Command::new(&editor).arg(&preliminary_path).status()?;
if !status.success() { if !status.success() {

View file

@ -72,13 +72,19 @@ pub fn run_edit(number: usize) -> Result<(), StreamdError> {
.get("file") .get("file")
.ok_or(StreamdError::MissingFilePath)?; .ok_or(StreamdError::MissingFilePath)?;
let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string()); let editor = std::env::var("EDITOR").unwrap_or_else(|_| {
let line_arg = format!("+{}", task.start_line); if cfg!(windows) {
"notepad".to_string()
} else {
"vi".to_string()
}
});
let status = Command::new(&editor) let mut cmd = Command::new(&editor);
.arg(&line_arg) if !editor.to_lowercase().contains("notepad") {
.arg(file_path) cmd.arg(format!("+{}", task.start_line));
.status()?; }
let status = cmd.arg(file_path).status()?;
if !status.success() { if !status.success() {
return Err(StreamdError::IoError(std::io::Error::other( return Err(StreamdError::IoError(std::io::Error::other(

View file

@ -37,8 +37,10 @@ impl Settings {
fn config_path() -> PathBuf { fn config_path() -> PathBuf {
if let Some(proj_dirs) = ProjectDirs::from("", "", "streamd") { if let Some(proj_dirs) = ProjectDirs::from("", "", "streamd") {
proj_dirs.config_dir().join("config.toml") proj_dirs.config_dir().join("config.toml")
} else if let Some(base_dirs) = directories::BaseDirs::new() {
base_dirs.config_dir().join("streamd").join("config.toml")
} else { } else {
PathBuf::from("~/.config/streamd/config.toml") PathBuf::from("streamd_config.toml")
} }
} }
} }