Merge pull request #28 from anthonylavado/fix-path

Create the needed cache folder
This commit is contained in:
Anthony Lavado 2020-05-17 02:48:54 -04:00 committed by GitHub
commit c04cf6e320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,23 @@ var task = Process()
button.image = NSImage(named:NSImage.Name("StatusBarButtonImage"))
}
let fileManager = FileManager.default
let home = FileManager.default.homeDirectoryForCurrentUser
let appFolder = home.appendingPathComponent(".local/share")
var isDirectory: ObjCBool = false
let folderExists = fileManager.fileExists(atPath: appFolder.path,
isDirectory: &isDirectory)
if !folderExists || !isDirectory.boolValue {
do {
// 4
try fileManager.createDirectory(at: appFolder,
withIntermediateDirectories: true,
attributes: nil)
} catch {
//failure
}
}
let path = Bundle.main.path(forAuxiliaryExecutable: "jellyfin")
task.launchPath = path