Skip to content

Commit

Permalink
windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lochlan Wansbrough committed Oct 12, 2024
1 parent 24d228c commit 665b81b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ members = [
]

[workspace.package]
version = "0.1.5"
version = "0.1.6"
authors = ["Lochlan Wansbrough"]
edition = "2021"
rust-version = "1.80.0"

[workspace.dependencies]
rune = { path = "crates/rune", version = "0.1.5" }
rune = { path = "crates/rune", version = "0.1.6" }
3 changes: 0 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::{
env,
fs::{self, File, OpenOptions, Permissions},
io::{self, BufWriter, ErrorKind, Read, Write},
os::unix::fs::{OpenOptionsExt, PermissionsExt},
path::{Path, PathBuf},
process::{Command, Stdio},
};
Expand Down
17 changes: 12 additions & 5 deletions src/commands/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ use std::{
env,
fs::{self, File, OpenOptions},
io::{self, BufWriter, Write},
os::unix::fs::OpenOptionsExt,
path::PathBuf,
process::{Command, Stdio},
};

#[cfg(not(target_os = "windows"))]
use std::os::unix::fs::OpenOptionsExt;

use current_platform::CURRENT_PLATFORM;
use semver::Version;
use toml::Table;
Expand Down Expand Up @@ -167,11 +169,16 @@ async fn install_rustup(settings: &Settings) -> Result<()> {

let out_path = rustup_dir.join(filename);
println!("{}", out_path.to_str().unwrap());
let file = OpenOptions::new()

let mut open_options = OpenOptions::new();
let open_options = open_options
.write(true)
.create(true)
.mode(0o755) // set the permissions at creation
.open(&out_path)?;
.create(true);

#[cfg(not(target_os = "windows"))]
let open_options = open_options.mode(0o755);

let file = open_options.open(&out_path)?;

let mut out = BufWriter::new(file);
out.write_all(&content.as_ref())?;
Expand Down

0 comments on commit 665b81b

Please sign in to comment.