Compare commits

..

No commits in common. "dbc68da5c9f5e9469d807a287f56e7b6c7d71335" and "e562af0dc3d6cfd8296d47d617a2aaca810ba92a" have entirely different histories.

6 changed files with 10 additions and 68 deletions

View file

@ -49,17 +49,12 @@ jobs:
if: steps.version.outputs.SKIP != 'true' if: steps.version.outputs.SKIP != 'true'
run: nix build .#streamd-musl -o result-musl run: nix build .#streamd-musl -o result-musl
- name: Build Windows binary
if: steps.version.outputs.SKIP != 'true'
run: nix build .#streamd-windows -o result-windows
- name: Prepare release artifacts - name: Prepare release artifacts
if: steps.version.outputs.SKIP != 'true' if: steps.version.outputs.SKIP != 'true'
run: | run: |
mkdir -p release mkdir -p release
cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64 cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64
cp result-windows/bin/streamd.exe release/streamd-${{ steps.version.outputs.VERSION }}-windows-x86_64.exe
- name: Create release - name: Create release
if: steps.version.outputs.SKIP != 'true' if: steps.version.outputs.SKIP != 'true'

View file

@ -132,38 +132,6 @@
in in
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; }); craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
mkWindowsCraneLib =
system:
let
pkgs = mkPkgs system;
toolchain = pkgs.rust-bin.stable.latest.default.override {
targets = [ "x86_64-pc-windows-gnu" ];
};
in
(crane.mkLib pkgs).overrideToolchain toolchain;
mkStreamdWindows =
system:
let
pkgs = mkPkgs system;
pkgsCross = pkgs.pkgsCross.mingwW64;
craneLib = mkWindowsCraneLib system;
commonArgs = {
src = craneLib.path ./.;
pname = "streamd";
inherit version;
strictDeps = true;
CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu";
CC_x86_64_pc_windows_gnu = "${pkgsCross.stdenv.cc}/bin/x86_64-w64-mingw32-gcc";
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = "${pkgsCross.stdenv.cc}/bin/x86_64-w64-mingw32-gcc";
nativeBuildInputs = [ pkgsCross.stdenv.cc ];
buildInputs = [ pkgsCross.windows.pthreads ];
doCheck = false;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
mkStreamdDeb = mkStreamdDeb =
system: system:
let let
@ -213,10 +181,9 @@
streamd = mkStreamd system; streamd = mkStreamd system;
streamd-musl = mkStreamdMusl system; streamd-musl = mkStreamdMusl system;
streamd-deb = mkStreamdDeb system; streamd-deb = mkStreamdDeb system;
streamd-windows = mkStreamdWindows system;
in in
{ {
inherit streamd streamd-musl streamd-deb streamd-windows; inherit streamd streamd-musl streamd-deb;
default = streamd; default = streamd;
} }
); );

View file

@ -67,13 +67,7 @@ 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(|_| { let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string());
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,13 +24,7 @@ pub fn run() -> Result<(), StreamdError> {
drop(file); drop(file);
// Open in editor // Open in editor
let editor = std::env::var("EDITOR").unwrap_or_else(|_| { let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string());
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

@ -92,19 +92,13 @@ 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(|_| { let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string());
if cfg!(windows) { let line_arg = format!("+{}", task.start_line);
"notepad".to_string()
} else {
"vi".to_string()
}
});
let mut cmd = Command::new(&editor); let status = Command::new(&editor)
if !editor.to_lowercase().contains("notepad") { .arg(&line_arg)
cmd.arg(format!("+{}", task.start_line)); .arg(file_path)
} .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,10 +37,8 @@ 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("streamd_config.toml") PathBuf::from("~/.config/streamd/config.toml")
} }
} }
} }