Permalink
Browse files

Used platform-independent path separators.

  • Loading branch information...
1 parent 1499056 commit ce4c337f82fdf32b0a143a54ba449e26e8901509 koral committed Dec 24, 2011
Showing with 7 additions and 4 deletions.
  1. +4 −3 Hbro/Core.hs
  2. +2 −1 Hbro/Socket.hs
  3. +1 −0 hbro.cabal
View
@@ -45,6 +45,7 @@ import Network.URI
import System.Console.CmdArgs
import System.Directory
import System.Environment.XDG.BaseDir
+import System.FilePath
import System.Glib.Signals
import System.IO
import System.Posix.Process
@@ -93,7 +94,7 @@ defaultConfig directories = Config {
mCommonDirectories = directories,
mHomePage = "https://encrypted.google.com/",
mSocketDir = mTemporary directories,
- mUIFile = (mConfiguration directories) ++ "/ui.xml",
+ mUIFile = (mConfiguration directories) ++ pathSeparator:"ui.xml",
mKeyEventHandler = simpleKeyEventHandler,
mKeyEventCallback = \_ -> simpleKeyEventCallback (keysListToMap []),
mWebSettings = [],
@@ -161,7 +162,7 @@ realMain' config options gui@GUI {mWebView = webView, mWindow = window} context
Just uri -> do
fileURI <- doesFileExist uri
case fileURI of
- True -> getCurrentDirectory >>= \dir -> webViewLoadUri webView $ "file://" ++ dir ++ "/" ++ uri
+ True -> getCurrentDirectory >>= \dir -> webViewLoadUri webView $ "file://" ++ dir ++ pathSeparator:uri
_ -> webViewLoadUri webView uri
whenLoud $ putStrLn ("Loading " ++ uri ++ "...")
@@ -170,7 +171,7 @@ realMain' config options gui@GUI {mWebView = webView, mWindow = window} context
-- Open socket
pid <- getProcessID
let commandsList = M.fromList $ defaultCommandsList ++ commands
- let socketURI = "ipc://" ++ socketDir ++ "/hbro." ++ show pid
+ let socketURI = "ipc://" ++ socketDir ++ pathSeparator:"hbro." ++ show pid
void $ forkIO (openRepSocket context socketURI (listenToCommands environment commandsList))
-- Manage POSIX signals
View
@@ -14,6 +14,7 @@ import Graphics.UI.Gtk.General.General
import Graphics.UI.Gtk.WebKit.WebView
import System.Console.CmdArgs (whenNormal, whenLoud)
+import System.FilePath
import System.ZMQ
-- }}}
@@ -57,7 +58,7 @@ closeSocket context socketURI = void $ sendCommand context socketURI "QUIT"
-- | Return the socket path to use for the given browser's process ID.
processIDToSocket :: String -> String -> String
-processIDToSocket pid socketDir = "ipc://" ++ socketDir ++ "/hbro." ++ pid
+processIDToSocket pid socketDir = "ipc://" ++ socketDir ++ pathSeparator:"hbro." ++ pid
-- | Send a single command (through a Request socket) to the given Response socket,
-- and return the answer.
View
@@ -31,6 +31,7 @@ Library
containers,
directory,
dyre,
+ filepath,
glib,
gtk,
mtl,

0 comments on commit ce4c337

Please sign in to comment.