Skip to content

Commit

Permalink
fix: empty file bug
Browse files Browse the repository at this point in the history
  • Loading branch information
megatank58 committed Oct 9, 2022
1 parent 2bb029d commit a938841
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.0
2.6.1
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxup"
version = "2.6.0"
version = "2.6.1"
edition = "2021"

[profile.release]
Expand Down
31 changes: 19 additions & 12 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,25 @@ pub async fn install(os: OS, oxup: bool) -> Result<(), Box<dyn std::error::Error

info!["Moving package"];

match os {
OS::Windows => std::fs::write(format!(r"C:\bin\{bin}.exe"), bytes)?,
_ => {
std::fs::OpenOptions::new()
.create(true)
.write(true)
.mode(0o770)
.open(format!(
"{}/.oxido/bin/{bin}",
std::env::var("HOME").unwrap()
))?;
}
std::fs::write(
match os {
OS::Windows => format!(r"C:\bin\{bin}.exe"),
_ => {
format!("{}/.oxido/bin/{bin}", std::env::var("HOME").unwrap())
}
},
bytes,
)?;

if os == OS::Linux || os == OS::Mac {
std::fs::OpenOptions::new()
.create(true)
.write(true)
.mode(0o770)
.open(format!(
"{}/.oxido/bin/{bin}",
std::env::var("HOME").unwrap()
))?;
}

success![format!("{bin} has been installed!")];
Expand Down

0 comments on commit a938841

Please sign in to comment.