Explorar el Código

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 hace 9 años
padre
commit
c48a1e3516
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  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 "";
 }