From 68b3beefd87468204a8d8252d3487fae95b43f80 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 9 Jul 2013 20:50:41 -0400 Subject: linux standalone auto-install icons --- Assistant/Install/Menu.hs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'Assistant/Install') diff --git a/Assistant/Install/Menu.hs b/Assistant/Install/Menu.hs index 940a2b32c..41ec855b6 100644 --- a/Assistant/Install/Menu.hs +++ b/Assistant/Install/Menu.hs @@ -9,14 +9,20 @@ module Assistant.Install.Menu where +import Common + import Utility.FreeDesktop -installMenu :: FilePath -> FilePath -> IO () -installMenu command file = +installMenu :: FilePath -> FilePath -> FilePath -> FilePath -> IO () +installMenu command menufile iconsrcdir icondir = do #ifdef darwin_HOST_OS return () #else - writeDesktopMenuFile (fdoDesktopMenu command) file + writeDesktopMenuFile (fdoDesktopMenu command) menufile + installIcon (iconsrcdir "logo.svg") $ + iconFilePath (iconBaseName ++ ".svg") "scalable" icondir + installIcon (iconsrcdir "favicon.png") $ + iconFilePath (iconBaseName ++ ".png") "16x16" icondir #endif {- The command can be either just "git-annex", or the full path to use @@ -27,5 +33,15 @@ fdoDesktopMenu command = genDesktopEntry "Track and sync the files in your Git Annex" False (command ++ " webapp") - (Just "git-annex") -- icon base name + (Just iconBaseName) ["Network", "FileTransfer"] + +installIcon :: FilePath -> FilePath -> IO () +installIcon src dest = do + createDirectoryIfMissing True (parentDir dest) + withBinaryFile src ReadMode $ \hin -> + withBinaryFile dest WriteMode $ \hout -> + hGetContents hin >>= hPutStr hout + +iconBaseName :: String +iconBaseName = "git-annex" -- cgit v1.2.3