renamed temp_dir to temp_path

This commit is contained in:
2025-03-18 17:56:48 +03:00
parent 08e39bbac8
commit fd8ba7260a
+16 -16
View File
@@ -88,24 +88,24 @@ fn main() -> Result<(), Error> {
assert!(manifest_path.exists(), "Manifest path does not exist"); assert!(manifest_path.exists(), "Manifest path does not exist");
let current_dir: PathBuf = absolute(Path::new("."))?; let current_dir: PathBuf = absolute(Path::new("."))?;
let temp_dir: PathBuf = current_dir.join("temp"); let temp_path: PathBuf = current_dir.join("temp");
if temp_dir.exists() { if temp_path.exists() {
remove_dir_all(&temp_dir)?; remove_dir_all(&temp_path)?;
} }
create_dir(&temp_dir)?; create_dir(&temp_path)?;
copy(&manifest_path, temp_dir.join("manifest"))?; copy(&manifest_path, temp_path.join("manifest"))?;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let build_romfs_path = temp_dir.join("build_romfs.exe"); let build_romfs_path = temp_path.join("build_romfs.exe");
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let build_pfs0_path = temp_dir.join("build_pfs0.exe"); let build_pfs0_path = temp_path.join("build_pfs0.exe");
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
let build_romfs_path: PathBuf = temp_dir.join("build_romfs"); let build_romfs_path: PathBuf = temp_path.join("build_romfs");
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
let build_pfs0_path: PathBuf = temp_dir.join("build_pfs0"); let build_pfs0_path: PathBuf = temp_path.join("build_pfs0");
let mut build_romfs_file: File = File::create(&build_romfs_path)?; let mut build_romfs_file: File = File::create(&build_romfs_path)?;
build_romfs_file.write_all(BUILD_ROMFS_BIN)?; build_romfs_file.write_all(BUILD_ROMFS_BIN)?;
@@ -131,22 +131,22 @@ fn main() -> Result<(), Error> {
if item.is_dir() && name == "romfs" { if item.is_dir() && name == "romfs" {
println!("Found romfs directory. Building romfs.bin..."); println!("Found romfs directory. Building romfs.bin...");
std::process::Command::new(&build_romfs_path) std::process::Command::new(&build_romfs_path)
.current_dir(&temp_dir) .current_dir(&temp_path)
.arg(&item) .arg(&item)
.arg(&temp_dir.join("romfs.bin")) .arg(&temp_path.join("romfs.bin"))
.status()?; .status()?;
continue; continue;
} }
if files_to_copy.contains(&&name) { if files_to_copy.contains(&&name) {
println!("Found {}, copying...", name); println!("Found {}, copying...", name);
copy(&item, &temp_dir.join(name))?; copy(&item, &temp_path.join(name))?;
continue; continue;
} }
if name.ends_with(".ips") { if name.ends_with(".ips") {
println!("Found {}, copying...", name); println!("Found {}, copying...", name);
copy(&item, &temp_dir.join(name))?; copy(&item, &temp_path.join(name))?;
continue; continue;
} }
} }
@@ -156,12 +156,12 @@ fn main() -> Result<(), Error> {
println!("Building {}...", output_path.display()); println!("Building {}...", output_path.display());
std::process::Command::new(&build_pfs0_path) std::process::Command::new(&build_pfs0_path)
.current_dir(&temp_dir) .current_dir(&temp_path)
.arg(&temp_dir) .arg(&temp_path)
.arg(&output_path) .arg(&output_path)
.status()?; .status()?;
remove_dir_all(&temp_dir)?; remove_dir_all(&temp_path)?;
Ok(()) Ok(())
} }