Skip to content

Commit

Permalink
Fix path bugs in ArchiveUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
lukhnos committed Feb 14, 2022
1 parent 4f9b63d commit 2a3c2ab
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Source/Installer/ArchiveUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// OTHER DEALINGS IN THE SOFTWARE.

import Cocoa
import Foundation

struct ArchiveUtil {
var appName: String
Expand Down Expand Up @@ -95,16 +96,16 @@ struct ArchiveUtil {
unzipTask.waitUntilExit()

assert(unzipTask.terminationStatus == 0, "Must successfully unzipped")
guard let result = (tempFilePath as NSString).appendingPathExtension(targetAppBundleName) else {
return nil
}
assert(FileManager.default.fileExists(atPath: result), "App bundle must be unzipped at \(resourcePath).")
let result = (tempFilePath as NSString).appendingPathComponent(targetAppBundleName)
assert(FileManager.default.fileExists(atPath: result), "App bundle must be unzipped at \(result).")
return result
}

private var notarizedArchivesPath: String? {
let resourePath = Bundle.main.resourcePath
let notarizedArchivesPath = resourePath?.appending("NotarizedArchives")
guard let resourePath = Bundle.main.resourcePath else {
return nil
}
let notarizedArchivesPath = (resourePath as NSString).appendingPathComponent("NotarizedArchives")
return notarizedArchivesPath
}

Expand All @@ -114,7 +115,7 @@ struct ArchiveUtil {
return nil
}
let notarizedArchiveBasename = "\(appName)-r\(bundleVersion).zip"
let notarizedArchive = notarizedArchivesPath.appending(notarizedArchiveBasename)
let notarizedArchive = (notarizedArchivesPath as NSString).appendingPathComponent(notarizedArchiveBasename)
return notarizedArchive
}

Expand Down

0 comments on commit 2a3c2ab

Please sign in to comment.