diff --git a/src/main/java/com/reandroid/archive/Archive.java b/src/main/java/com/reandroid/archive/Archive.java index b14be48a0..e97c61055 100644 --- a/src/main/java/com/reandroid/archive/Archive.java +++ b/src/main/java/com/reandroid/archive/Archive.java @@ -24,6 +24,7 @@ import com.reandroid.utils.collection.ArrayIterator; import com.reandroid.utils.collection.CollectionUtil; import com.reandroid.utils.collection.ComputeIterator; +import com.reandroid.utils.io.FilePermissions; import com.reandroid.utils.io.FileUtil; import com.reandroid.utils.io.IOUtil; @@ -182,9 +183,11 @@ public void extract(File file, ArchiveEntry archiveEntry, APKLogger logger) thro } @SuppressWarnings("ResultOfMethodCallIgnored") private void applyAttributes(ArchiveEntry archiveEntry, File file) { - CentralEntryHeader ceh = archiveEntry.getCentralEntryHeader(); - ceh.getFilePermissions().apply(file); - long time = Archive.dosToJavaDate(ceh.getDosTime()).getTime(); + FilePermissions permissions = archiveEntry.getFilePermissions(); + if(permissions.get() != 0) { + permissions.apply(file); + } + long time = Archive.dosToJavaDate(archiveEntry.getDosTime()).getTime(); file.setLastModified(time); } abstract void extractStored(File file, ArchiveEntry archiveEntry) throws IOException; diff --git a/src/main/java/com/reandroid/archive/ArchiveEntry.java b/src/main/java/com/reandroid/archive/ArchiveEntry.java index c0f4b0c69..80d1c1df6 100644 --- a/src/main/java/com/reandroid/archive/ArchiveEntry.java +++ b/src/main/java/com/reandroid/archive/ArchiveEntry.java @@ -18,6 +18,7 @@ import com.reandroid.archive.block.CentralEntryHeader; import com.reandroid.archive.block.LocalFileHeader; import com.reandroid.utils.HexUtil; +import com.reandroid.utils.io.FilePermissions; public class ArchiveEntry { private final LocalFileHeader localFileHeader; @@ -91,6 +92,9 @@ public boolean isFile() { public boolean isDirectory() { return this.getName().endsWith("/"); } + public FilePermissions getFilePermissions() { + return getCentralEntryHeader().getFilePermissions(); + } public CentralEntryHeader getCentralEntryHeader(){ CentralEntryHeader ceh = localFileHeader.getCentralEntryHeader(); if(ceh == null){