refactor: normalize file path

This commit is contained in:
zhom
2025-07-28 17:58:39 +04:00
parent 573d39c0b5
commit 6f80b5ac13
2 changed files with 11 additions and 13 deletions
+9 -2
View File
@@ -88,9 +88,16 @@ fn extract_application(app_dir: &Path) -> Result<()> {
for i in 0..archive.len() {
let mut file = archive.by_index(i).context("Failed to read zip entry")?;
let outpath = app_dir.join(file.name());
if file.name().ends_with('/') {
// Normalize the file path for the current platform
// Zip files use forward slashes, but we need proper path separators for the OS
let file_name = file.name();
// Use Path::new to properly handle path separators across platforms
let normalized_path = Path::new(file_name);
let outpath = app_dir.join(normalized_path);
if file_name.ends_with('/') {
// Directory
fs::create_dir_all(&outpath).context("Failed to create directory")?;
} else {
+2 -11
View File
@@ -600,17 +600,8 @@ impl BundlerTestHelper {
fs::set_permissions(executable_path, perms)?;
}
let mut cmd = if cfg!(windows) {
// On Windows, run batch files through cmd.exe
let mut cmd = Command::new("cmd");
cmd.args(["/C", executable_path.to_str().unwrap()]);
cmd.args(args);
cmd
} else {
let mut cmd = Command::new(executable_path);
cmd.args(args);
cmd
};
let mut cmd = Command::new(executable_path);
cmd.args(args);
for (key, value) in env_vars {
cmd.env(key, value);