Windows: Fix opening file browser from webapp when repo is in a directory with spaces.

This commit is contained in:
Joey Hess 2014-06-17 14:18:15 -04:00
parent 5977e161f3
commit 8f98d28da4
2 changed files with 8 additions and 4 deletions

View file

@ -118,20 +118,22 @@ openFileBrowser = do
path <- liftAnnex $ fromRepo Git.repoPath
#ifdef darwin_HOST_OS
let cmd = "open"
let params = [Param path]
let p = proc cmd [path]
#else
#ifdef mingw32_HOST_OS
{- Changing to the directory and then opening . works around
- spaces in directory name, etc. -}
let cmd = "cmd"
let params = [Param $ "/c start " ++ path]
let p = (proc cmd ["/c start ."]) { cwd = Just path }
#else
let cmd = "xdg-open"
let params = [Param path]
let p = proc cmd [path]
#endif
#endif
ifM (liftIO $ inPath cmd)
( do
let run = void $ liftIO $ forkIO $ void $
boolSystem cmd params
createProcess p
run
#ifdef mingw32_HOST_OS
{- On windows, if the file browser is not