summaryrefslogtreecommitdiff
path: root/Assistant/Install
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Install')
-rw-r--r--Assistant/Install/AutoStart.hs24
1 files changed, 19 insertions, 5 deletions
diff --git a/Assistant/Install/AutoStart.hs b/Assistant/Install/AutoStart.hs
index 692774939..85ce98287 100644
--- a/Assistant/Install/AutoStart.hs
+++ b/Assistant/Install/AutoStart.hs
@@ -1,23 +1,37 @@
-{- Assistant OSX autostart file installation
+{- Assistant autostart file installation
-
- Copyright 2012 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Assistant.Install.AutoStart where
+import Utility.FreeDesktop
import Utility.OSX
import Utility.Path
import System.Directory
-{- Installs an autostart plist file for OSX. -}
installAutoStart :: FilePath -> FilePath -> IO ()
installAutoStart command file = do
+#ifdef darwin_HOST_OS
createDirectoryIfMissing True (parentDir file)
- writeFile file $ genOSXAutoStartFile autoStartLabel command
+ writeFile file $ genOSXAutoStartFile osxAutoStartLabel command
["assistant", "--autostart"]
+#else
+ writeDesktopMenuFile (fdoAutostart command) file
+#endif
+
+osxAutoStartLabel :: String
+osxAutoStartLabel = "com.branchable.git-annex.assistant"
-autoStartLabel :: String
-autoStartLabel = "com.branchable.git-annex.assistant"
+fdoAutostart :: FilePath -> DesktopEntry
+fdoAutostart command = genDesktopEntry
+ "Git Annex Assistant"
+ "Autostart"
+ False
+ (command ++ " assistant --autostart")
+ []