Просмотр исходного кода

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 лет назад
Родитель
Сommit
c48a1e3516
1 измененных файлов с 9 добавлено и 2 удалено
  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 "";
 }