diff options
author | Joey Hess <joey@kitenet.net> | 2013-06-10 23:16:18 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-06-10 23:55:53 -0400 |
commit | 924b776dfd494da45ce2274a7080b4e548cdfd11 (patch) | |
tree | 7a84f56620f0b49cc86b71c43dad662142143b6d /Command | |
parent | 1a5af5aff3830716e5692775a35076e16fb71478 (diff) |
Android: Make the "Open webapp" menu item open the just created repository when a new repo is made.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/WebApp.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs index 52042321f..eeb23a164 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -157,15 +157,25 @@ firstRun listenhost = do Annex.eval state $ startDaemon True True listenhost $ Just $ sendurlback v - sendurlback v _origout _origerr url _htmlshim = putMVar v url + sendurlback v _origout _origerr url _htmlshim = do + recordUrl url + putMVar v url + +recordUrl :: String -> IO () +#ifdef __ANDROID__ +{- The Android app has a menu item that opens the url recorded + - in this file. -} +recordUrl url = writeFile "/sdcard/git-annex.home/.git-annex-url" url +#else +recordUrl _ = noop +#endif openBrowser :: Maybe FilePath -> FilePath -> String -> Maybe Handle -> Maybe Handle -> IO () #ifndef __ANDROID__ openBrowser mcmd htmlshim _realurl outh errh = runbrowser #else openBrowser mcmd htmlshim realurl outh errh = do - {- The Android app has a menu item that opens this file. -} - writeFile "/sdcard/git-annex.home/.git-annex-url" url + recordUrl url {- Android's `am` command does not work reliably across the - wide range of Android devices. Intead, FIFO should be set to - the filename of a fifo that we can write the URL to. -} |