summaryrefslogtreecommitdiff
path: root/Command/WebApp.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-06-10 18:29:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-06-10 18:37:33 -0400
commit465c36e8f6a45b888e8f7be8baa52f0eb1759f77 (patch)
tree9e3750f04e534f5ce616e3362b7196d47fa333bf /Command/WebApp.hs
parented8db68eca09a672666864fb9b84c14e6c106d67 (diff)
Windows: Fix opening webapp when repository is in a directory with spaces in the path.
Diffstat (limited to 'Command/WebApp.hs')
-rw-r--r--Command/WebApp.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs
index 575d17330..e8d657052 100644
--- a/Command/WebApp.hs
+++ b/Command/WebApp.hs
@@ -34,7 +34,7 @@ import Annex.Version
import Control.Concurrent
import Control.Concurrent.STM
-import System.Process (env, std_out, std_err)
+import System.Process (env, std_out, std_err, cwd)
import Network.Socket (HostName)
import System.Environment (getArgs)
@@ -215,7 +215,16 @@ openBrowser mcmd htmlshim realurl outh errh = do
where
p = case mcmd of
Just cmd -> proc cmd [htmlshim]
- Nothing -> browserProc url
+ Nothing ->
+#ifndef mingw32_HOST_OS
+ browserProc url
+#else
+ {- Windows hack to avoid using the full path,
+ - which might contain spaces that cause problems
+ - for browserProc. -}
+ (browserProc (takeFileName htmlshim))
+ { cwd = Just (takeDirectory htmlshim) }
+#endif
#ifdef __ANDROID__
{- Android does not support file:// urls, but neither is
- the security of the url in the process table important