mirror of
https://github.com/arabianq/build_msp.git
synced 2026-04-27 22:11:23 +00:00
fix os error 26
This commit is contained in:
+14
-6
@@ -1,10 +1,10 @@
|
|||||||
use clap::{Error, Parser};
|
use clap::{Error, Parser};
|
||||||
|
|
||||||
use std::fs::{
|
use std::fs::{
|
||||||
copy, create_dir, read_dir, remove_dir_all, remove_file, set_permissions, File, ReadDir,
|
File, ReadDir, copy, create_dir, read_dir, remove_dir_all, remove_file, set_permissions,
|
||||||
};
|
};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::{absolute, Path, PathBuf};
|
use std::path::{Path, PathBuf, absolute};
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
const BUILD_ROMFS_BIN: &[u8] = include_bytes!("../switch-tools/build_romfs.exe");
|
const BUILD_ROMFS_BIN: &[u8] = include_bytes!("../switch-tools/build_romfs.exe");
|
||||||
@@ -112,16 +112,24 @@ fn main() -> Result<(), Error> {
|
|||||||
build_pfs0_path = temp_path.join("build_pfs0");
|
build_pfs0_path = temp_path.join("build_pfs0");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut build_romfs_file: File = File::create(&build_romfs_path)?;
|
#[cfg(target_os = "windows")]
|
||||||
let mut build_pfs0_file: File = File::create(&build_pfs0_path)?;
|
{
|
||||||
build_romfs_file.write_all(BUILD_ROMFS_BIN)?;
|
let mut build_romfs_file: File = File::create(&build_romfs_path)?;
|
||||||
build_pfs0_file.write_all(BUILD_PFS0_BIN)?;
|
let mut build_pfs0_file: File = File::create(&build_pfs0_path)?;
|
||||||
|
build_romfs_file.write_all(BUILD_ROMFS_BIN)?;
|
||||||
|
build_pfs0_file.write_all(BUILD_PFS0_BIN)?;
|
||||||
|
}
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
{
|
{
|
||||||
|
let mut build_romfs_file: File = File::create(&build_romfs_path)?;
|
||||||
|
build_romfs_file.write_all(BUILD_ROMFS_BIN)?;
|
||||||
set_permissions(
|
set_permissions(
|
||||||
&build_romfs_path,
|
&build_romfs_path,
|
||||||
std::os::unix::fs::PermissionsExt::from_mode(0o755),
|
std::os::unix::fs::PermissionsExt::from_mode(0o755),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
let mut build_pfs0_file: File = File::create(&build_pfs0_path)?;
|
||||||
|
build_pfs0_file.write_all(BUILD_PFS0_BIN)?;
|
||||||
set_permissions(
|
set_permissions(
|
||||||
&build_pfs0_path,
|
&build_pfs0_path,
|
||||||
std::os::unix::fs::PermissionsExt::from_mode(0o755),
|
std::os::unix::fs::PermissionsExt::from_mode(0o755),
|
||||||
|
|||||||
Reference in New Issue
Block a user