aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src')
-rw-r--r--crates/shirabe/src/package/archiver/zip_archiver.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/shirabe/src/package/archiver/zip_archiver.rs b/crates/shirabe/src/package/archiver/zip_archiver.rs
index e5bb613d..5604c07d 100644
--- a/crates/shirabe/src/package/archiver/zip_archiver.rs
+++ b/crates/shirabe/src/package/archiver/zip_archiver.rs
@@ -5,9 +5,7 @@ use crate::package::archiver::ArchiverInterface;
use crate::util::Filesystem;
use crate::util::Platform;
use indexmap::IndexMap;
-use shirabe_php_shim::{
- PhpMixed, RuntimeException, ZipArchive, class_exists, fileperms, method_exists, realpath,
-};
+use shirabe_php_shim::{RuntimeException, ZipArchive, class_exists, fileperms, realpath};
use std::path::PathBuf;
#[derive(Debug)]
@@ -71,16 +69,18 @@ impl ArchiverInterface for ZipArchiver {
));
}
+ // Ensure to preserve the permission umasks for the filepath in the archive.
+ let perms = fileperms(&filepath);
+
if filepath.is_dir() {
- zip.add_empty_dir(&relative_path.to_string_lossy());
+ zip.add_empty_dir(
+ &relative_path.to_string_lossy(),
+ ZipArchive::OPSYS_UNIX,
+ perms << 16,
+ );
} else {
- zip.add_file(&filepath, &relative_path.to_string_lossy());
- }
-
- // setExternalAttributesName() is only available with libzip 0.11.2 or above
- if method_exists(&PhpMixed::Null, "setExternalAttributesName") {
- let perms = fileperms(&filepath);
- zip.set_external_attributes_name(
+ zip.add_file(
+ &filepath,
&relative_path.to_string_lossy(),
ZipArchive::OPSYS_UNIX,
perms << 16,