diff --git a/src/GUI/Gtk.hs b/src/GUI/Gtk.hs index 4a60bf7..552bbb4 100644 --- a/src/GUI/Gtk.hs +++ b/src/GUI/Gtk.hs @@ -4,11 +4,22 @@ module Main where import Graphics.UI.Gtk import GUI.Gtk.Gui +import Safe + ( + headDef + ) +import System.Environment + ( + getArgs + ) + main :: IO () main = do _ <- initGUI - startMainWindow + args <- getArgs + + startMainWindow (headDef "/" args) mainGUI diff --git a/src/GUI/Gtk/Gui.hs b/src/GUI/Gtk/Gui.hs index 42e221e..6858883 100644 --- a/src/GUI/Gtk/Gui.hs +++ b/src/GUI/Gtk/Gui.hs @@ -458,8 +458,8 @@ withErrorDialog io = do -- |Set up the GUI. -startMainWindow :: IO () -startMainWindow = do +startMainWindow :: FilePath -> IO () +startMainWindow startdir = do settings <- newTVarIO (MkFMSettings False True) @@ -469,7 +469,7 @@ startMainWindow = do filePix <- getIcon IFile 24 errorPix <- getIcon IError 24 - fsState <- readPath' "/" >>= newTVarIO + fsState <- readPath' startdir >>= newTVarIO operationBuffer <- newTVarIO (Right None)