diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs index 0458997674..26eb52d784 100644 --- a/Assistant/WebApp/DashBoard.hs +++ b/Assistant/WebApp/DashBoard.hs @@ -118,21 +118,27 @@ getFileBrowserR = whenM openFileBrowser redirectBack openFileBrowser :: Handler Bool openFileBrowser = do path <- liftAnnex $ fromRepo Git.repoPath - ifM (liftIO $ inPath cmd <&&> inPath cmd) +#ifdef darwin_HOST_OS + let cmd = "open" + let params = [Param path] +#else +#ifdef mingw32_HOST_OS + let cmd = "cmd" + let params = [Param $ "/c start " ++ path] +#else + let cmd = "xdg-open" + let params = [Param path] +#endif +#endif + ifM (liftIO $ inPath cmd) ( do void $ liftIO $ forkIO $ void $ - boolSystem cmd [Param path] + boolSystem cmd params return True , do void $ redirect $ "file://" ++ path return False ) - where -#ifdef darwin_HOST_OS - cmd = "open" -#else - cmd = "xdg-open" -#endif {- Transfer controls. The GET is done in noscript mode and redirects back - to the referring page. The POST is called by javascript. -}