Skip to content

Commit

Permalink
Simplify isDirectory logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Nov 6, 2024
1 parent 0a8b5bd commit 018c44a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Sources/Zip/Zip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,16 @@ public class Zip {
|| fileName[Int(fileInfo.size_filename - 1)] == "\\".cString(using: String.Encoding.utf8)?.first

do {
try FileManager.default.createDirectory(
atPath: (fullPath as NSString).deletingLastPathComponent,
withIntermediateDirectories: true,
attributes: directoryAttributes
)

if isDirectory {
try FileManager.default.createDirectory(
atPath: fullPath,
withIntermediateDirectories: true,
attributes: directoryAttributes)
} else {
try FileManager.default.createDirectory(
atPath: (fullPath as NSString).deletingLastPathComponent,
withIntermediateDirectories: true,
withIntermediateDirectories: false,
attributes: directoryAttributes
)
}
Expand Down

0 comments on commit 018c44a

Please sign in to comment.