Skip to content

Commit 16d32b6

Browse files
committed
Fix bin dir decompressing
1 parent 5d602c4 commit 16d32b6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Clop/ClopUtils.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,16 @@ func nsalert(error: String) {
556556

557557
if fm.contents(atPath: BIN_HASH_FILE.path) != BIN_ARCHIVE_HASH {
558558
mainActor { BM.decompressingBinaries = true }
559+
do {
560+
if fm.fileExists(atPath: GLOBAL_BIN_DIR.path) {
561+
try fm.removeItem(at: GLOBAL_BIN_DIR)
562+
}
563+
try fm.createDirectory(at: GLOBAL_BIN_DIR, withIntermediateDirectories: true, attributes: nil)
564+
} catch {
565+
nsalert(error: "Error resetting directory \(GLOBAL_BIN_DIR.path): \(error)")
566+
mainActor { BM.decompressingBinaries = false }
567+
exit(1)
568+
}
559569
let proc = shell("/usr/bin/tar", args: ["-xvf", BIN_ARCHIVE.path, "-C", GLOBAL_BIN_DIR.path], env: ["PATH": "\(LRZIP.deletingLastPathComponent().path):/usr/bin:/bin"], wait: true)
560570
print("Running: /usr/bin/tar -xvf \(BIN_ARCHIVE.path) -C \(GLOBAL_BIN_DIR.path)")
561571
if !proc.success {

ReleaseNotes/2.11.5.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Fixes
2+
3+
- Fix *PDF Optimisation Failed* because decompressing binaries might leave unwanted old files

0 commit comments

Comments
 (0)