From b3a50b863ade7dfae0a3558d2d9c89ca6c1f668a Mon Sep 17 00:00:00 2001 From: Francesco Paolo Severino Date: Mon, 9 Sep 2024 20:07:00 +0200 Subject: [PATCH] Try fix permission on Windows --- Sources/Zip/Zip.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Zip/Zip.swift b/Sources/Zip/Zip.swift index 44582720..8dd21b10 100644 --- a/Sources/Zip/Zip.swift +++ b/Sources/Zip/Zip.swift @@ -166,20 +166,20 @@ public class Zip { // Set file permissions from current `fileInfo` if fileInfo.external_fa != 0 { + // TODO: Set permissions properly on Windows + #if os(Windows) + try FileManager.default.setAttributes([.posixPermissions: 0o700], ofItemAtPath: fullPath) + #else let permissions = (fileInfo.external_fa >> 16) & 0x1FF // We will define a valid permission range between Owner read only to full access if permissions >= 0o400 && permissions <= 0o777 { do { - // TODO: Set permissions properly on Windows - #if os(Windows) - try FileManager.default.setAttributes([.posixPermissions: 0o700], ofItemAtPath: fullPath) - #else try FileManager.default.setAttributes([.posixPermissions: permissions], ofItemAtPath: fullPath) - #endif } catch { print("Failed to set permissions to file \(fullPath), error: \(error)") } } + #endif } ret = unzGoToNextFile(zip)