Windows: Fix opening webapp when repository is in a directory with spaces in the path.

This commit is contained in:
Joey Hess 2014-06-10 18:29:15 -04:00
parent d4e71929ba
commit 6eb5e6c135
3 changed files with 17 additions and 2 deletions

View file

@ -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

View file

@ -61,6 +61,10 @@ browserProc url = proc "am"
["start", "-a", "android.intent.action.VIEW", "-d", url]
#else
#ifdef mingw32_HOST_OS
-- Warning: On Windows, no quoting or escaping of the url seems possible,
-- so spaces in it will cause problems. One approach is to make the url
-- be a relative filename, and adjust the returned CreateProcess to change
-- to the directory it's in.
browserProc url = proc "cmd" ["/c start " ++ url]
#else
browserProc url = proc "xdg-open" [url]

2
debian/changelog vendored
View file

@ -4,6 +4,8 @@ git-annex (5.20140607) UNRELEASED; urgency=medium
* Avoid leaving behind .tmp files when failing in some cases, including
importing files to a disk that is full.
* Avoid bad commits after interrupted direct mode sync (or merge).
* Windows: Fix opening webapp when repository is in a directory with
spaces in the path.
-- Joey Hess <joeyh@debian.org> Mon, 09 Jun 2014 14:44:09 -0400