Ver código fonte

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 9 anos atrás
pai
commit
c48a1e3516
1 arquivos alterados com 9 adições e 2 exclusões
  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 "";
 }