Skip to content

Commit

Permalink
fix: file permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
megatank58 committed Oct 9, 2022
1 parent a938841 commit f6bb1bc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
2.6.2
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.1"
version = "2.6.2"
edition = "2021"

[profile.release]
Expand Down
16 changes: 5 additions & 11 deletions src/install.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::os::unix::prelude::OpenOptionsExt;

use crate::{info, success};
use reqwest::{
header::{HeaderMap, USER_AGENT},
Expand Down Expand Up @@ -58,21 +56,17 @@ pub async fn install(os: OS, oxup: bool) -> Result<(), Box<dyn std::error::Error
match os {
OS::Windows => format!(r"C:\bin\{bin}.exe"),
_ => {
format!("{}/.oxido/bin/{bin}", std::env::var("HOME").unwrap())
format!("{}/.oxido/bin/{bin}", std::env::var("HOME")?)
}
},
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()
))?;
std::process::Command::new("chmod").arg("-x").arg(format!(
"{}/.oxido/bin/{bin}",
std::env::var("HOME")?
));
}

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

0 comments on commit f6bb1bc

Please sign in to comment.