Procházet zdrojové kódy

Make sure that directory LaunchAgents is created before writing to it

This caused issues on new el capitan systems where the directory was
not created by default.

Fixes #177
Tobias Hieta před 9 roky
rodič
revize
c48a1e3516
1 změnil soubory, kde provedl 9 přidání a 2 odebrání
  1. 9 2
      src/utils/HelperLaunchd.cpp

+ 9 - 2
src/utils/HelperLaunchd.cpp

@@ -39,8 +39,15 @@ HelperLaunchd::HelperLaunchd(QObject* parent) : QObject(parent)
 QString HelperLaunchd::launchPlistPath()
 {
   QDir homeDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first();
-  if (homeDir.cd("Library") && homeDir.cd("LaunchAgents"))
-    return homeDir.filePath("tv.plex.player-helper.plist");
+  if (homeDir.cd("Library"))
+  {
+    if (!homeDir.exists("LaunchAgents"))
+      homeDir.mkdir("LaunchAgents");
+
+    if (homeDir.cd("LaunchAgents"))
+      return homeDir.filePath("tv.plex.player-helper.plist");
+  }
+
   return "";
 }