mirror of
https://github.com/zhom/banderole.git
synced 2026-06-06 06:23:53 +02:00
refactor: normalize file path
This commit is contained in:
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user