diff --git a/Jellyfin Server/ActionManager.swift b/Jellyfin Server/ActionManager.swift index 28a375d..cbf40c5 100644 --- a/Jellyfin Server/ActionManager.swift +++ b/Jellyfin Server/ActionManager.swift @@ -15,7 +15,7 @@ enum ActionManager { } static func showLogs() { - let logFolder = applicationSupportJellyfinFolder.appendingPathComponent("/log") + let logFolder = directoryExists(path: localShareJellyfinFolder.path) ? localShareJellyfinFolder.appendingPathComponent("/log") : applicationSupportJellyfinFolder.appendingPathComponent("/log") NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: logFolder.path) } diff --git a/Jellyfin Server/AppDelegate.swift b/Jellyfin Server/AppDelegate.swift index e6d544f..6439296 100755 --- a/Jellyfin Server/AppDelegate.swift +++ b/Jellyfin Server/AppDelegate.swift @@ -18,7 +18,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_: Notification) { statusItem.button?.image = NSImage(named: "StatusBarButtonImage") - createAppFolder() startJellyfinTask() createStatusBarMenu() } @@ -28,36 +27,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { jellyfinProcess.waitUntilExit() } - private func createAppFolder() { - // Old contents were stored in ~/.local/share - // Move to ~/Library/Application Support/Jellyfin - if directoryExists(path: localShareJellyfinFolder.path) { - do { - let contents = try FileManager.default.contentsOfDirectory(atPath: localShareJellyfinFolder.path) - - for contentName in contents { - let oldPath = localShareJellyfinFolder.appendingPathComponent(contentName) - let newPath = applicationSupportJellyfinFolder.appendingPathComponent(contentName) - try FileManager.default.moveItem(atPath: oldPath.path, - toPath: newPath.path) - } - - try FileManager.default.removeItem(atPath: localShareJellyfinFolder.path) - } catch { - present(alert: "Jellyfin Server was unable to properly migrate old directories.") - } - } - - if !directoryExists(path: applicationSupportJellyfinFolder.path) { - do { - try FileManager.default.createDirectory(atPath: applicationSupportJellyfinFolder.path, - withIntermediateDirectories: true) - } catch { - present(alert: "Jellyfin Server was unable to properly create necessary directories.") - } - } - } - private func startJellyfinTask() { let jellyfinPath = Bundle.main.path(forAuxiliaryExecutable: "jellyfin") let ffmpegPath = Bundle.main.path(forAuxiliaryExecutable: "ffmpeg") @@ -74,7 +43,13 @@ class AppDelegate: NSObject, NSApplicationDelegate { } jellyfinProcess.launchPath = jellyfinPath - jellyfinProcess.arguments = ["--webdir", webUIPath, "--ffmpeg", ffmpegPath, "--datadir", applicationSupportJellyfinFolder.path] + jellyfinProcess.arguments = ["--webdir", webUIPath, "--ffmpeg", ffmpegPath, "--datadir"] + + if directoryExists(path: localShareJellyfinFolder.path) { + jellyfinProcess.arguments?.append(localShareJellyfinFolder.path) + } else { + jellyfinProcess.arguments?.append(applicationSupportJellyfinFolder.path) + } do { try jellyfinProcess.run()