Skip to content

Commit 8c28af7

Browse files
loutskiyloutskiy
authored andcommitted
refactor
1 parent 9f01ef4 commit 8c28af7

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Installer/ProgressVC.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import LocalAuthentication
1616
class ProgressVC: NSViewController {
1717

1818
let kEXTENSION = ".app"
19+
let kSEARCH_PATH_DIR: FileManager.SearchPathDirectory = .downloadsDirectory
1920

2021
private var primaryLink = ""
2122

@@ -32,7 +33,7 @@ class ProgressVC: NSViewController {
3233

3334
func downloadFileDestination(fileName: String) -> DownloadRequest.DownloadFileDestination {
3435
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
35-
let documentsPath = NSSearchPathForDirectoriesInDomains(.downloadsDirectory, .userDomainMask, true)[0]
36+
let documentsPath = NSSearchPathForDirectoriesInDomains(self.kSEARCH_PATH_DIR, .userDomainMask, true)[0]
3637
let documentsURL = URL(fileURLWithPath: documentsPath, isDirectory: true)
3738
let fileURL = documentsURL.appendingPathComponent(fileName)
3839
print(fileURL)
@@ -42,7 +43,7 @@ class ProgressVC: NSViewController {
4243
}
4344

4445
func untar () {
45-
let documentsPath = NSSearchPathForDirectoriesInDomains(.downloadsDirectory, .userDomainMask, true)[0]
46+
let documentsPath = NSSearchPathForDirectoriesInDomains(kSEARCH_PATH_DIR, .userDomainMask, true)[0]
4647
let dataPath = documentsPath.appending("/\(Loader.shared.config.name ?? "installer")")
4748
let filePath = dataPath.appending("/file.tar.gz")
4849
let toPath = documentsPath.appending("/\(Loader.shared.config.name ?? "installer")/application")
@@ -104,7 +105,7 @@ class ProgressVC: NSViewController {
104105
let key = try! ObjectivePGP.readKeys(fromPath: path!)
105106
print(key)
106107

107-
let documentsPath = NSSearchPathForDirectoriesInDomains(.downloadsDirectory, .userDomainMask, true)[0]
108+
let documentsPath = NSSearchPathForDirectoriesInDomains(kSEARCH_PATH_DIR, .userDomainMask, true)[0]
108109
let documentsURL = URL(fileURLWithPath: documentsPath, isDirectory: true)
109110
let files = documentsURL.appendingPathComponent("/\(Loader.shared.config.name ?? "installer")/file.sig")
110111
let fileURL = documentsURL.appendingPathComponent("/\(Loader.shared.config.name ?? "installer")/file.tar.gz")
@@ -160,7 +161,7 @@ class ProgressVC: NSViewController {
160161
}
161162

162163
func copyAppToApplication () {
163-
let documentsPath = NSSearchPathForDirectoriesInDomains(.downloadsDirectory, .userDomainMask, true)[0]
164+
let documentsPath = NSSearchPathForDirectoriesInDomains(kSEARCH_PATH_DIR, .userDomainMask, true)[0]
164165
let documentsURL = URL(fileURLWithPath: documentsPath, isDirectory: true)
165166
let fileURL = documentsURL.appendingPathComponent("\(Loader.shared.config.name ?? "installer")")
166167

0 commit comments

Comments
 (0)