From a1c7e6908a26e10f6e1f23a51721664b5e2d838d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 02:53:53 +0900 Subject: chore(style): cargo fmt --- .../shirabe/src/package/archiver/zip_archiver.rs | 35 ++++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'crates/shirabe/src/package/archiver/zip_archiver.rs') diff --git a/crates/shirabe/src/package/archiver/zip_archiver.rs b/crates/shirabe/src/package/archiver/zip_archiver.rs index 104c544..ef5b40a 100644 --- a/crates/shirabe/src/package/archiver/zip_archiver.rs +++ b/crates/shirabe/src/package/archiver/zip_archiver.rs @@ -1,11 +1,13 @@ //! ref: composer/src/Composer/Package/Archiver/ZipArchiver.php -use indexmap::IndexMap; -use shirabe_php_shim::{class_exists, fileperms, method_exists, pack, realpath, PhpMixed, RuntimeException, ZipArchive}; use crate::package::archiver::archivable_files_finder::ArchivableFilesFinder; use crate::package::archiver::archiver_interface::ArchiverInterface; use crate::util::filesystem::Filesystem; use crate::util::platform::Platform; +use indexmap::IndexMap; +use shirabe_php_shim::{ + PhpMixed, RuntimeException, ZipArchive, class_exists, fileperms, method_exists, pack, realpath, +}; #[derive(Debug)] pub struct ZipArchiver; @@ -60,22 +62,29 @@ impl ArchiverInterface for ZipArchiver { // 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(&relative_path, ZipArchive::OPSYS_UNIX, perms << 16); + zip.set_external_attributes_name( + &relative_path, + ZipArchive::OPSYS_UNIX, + perms << 16, + ); } } if zip.close() { if !std::path::Path::new(&target).exists() { // create minimal valid ZIP file (Empty Central Directory + End of Central Directory record) - let eocd = pack("VvvvvVVv", &[ - PhpMixed::Int(0x06054b50), // End of central directory signature - PhpMixed::Int(0), // Number of this disk - PhpMixed::Int(0), // Disk where central directory starts - PhpMixed::Int(0), // Number of central directory records on this disk - PhpMixed::Int(0), // Total number of central directory records - PhpMixed::Int(0), // Size of central directory (bytes) - PhpMixed::Int(0), // Offset of start of central directory - PhpMixed::Int(0), // Comment length - ]); + let eocd = pack( + "VvvvvVVv", + &[ + PhpMixed::Int(0x06054b50), // End of central directory signature + PhpMixed::Int(0), // Number of this disk + PhpMixed::Int(0), // Disk where central directory starts + PhpMixed::Int(0), // Number of central directory records on this disk + PhpMixed::Int(0), // Total number of central directory records + PhpMixed::Int(0), // Size of central directory (bytes) + PhpMixed::Int(0), // Offset of start of central directory + PhpMixed::Int(0), // Comment length + ], + ); std::fs::write(&target, &eocd)?; } -- cgit v1.3.1