GTK: improve error handling in refreshView'
This could theoretically lead to infinite recursion, but only in case "/" is inaccessible or something. In which case the user has really bigger problems.
This commit is contained in:
parent
91b2dc9e4b
commit
2d447a05da
@ -201,6 +201,12 @@ createTreeView = do
|
|||||||
|
|
||||||
|
|
||||||
-- |Re-reads the current directory or the given one and updates the View.
|
-- |Re-reads the current directory or the given one and updates the View.
|
||||||
|
--
|
||||||
|
-- If the third argument is Nothing, it tries to re-read the current directory.
|
||||||
|
-- If that fails, it reads "/" instead.
|
||||||
|
--
|
||||||
|
-- If the third argument is (Just path) it tries to read "path". If that
|
||||||
|
-- fails, it tread "/" instead.
|
||||||
refreshView :: MyGUI
|
refreshView :: MyGUI
|
||||||
-> MyView
|
-> MyView
|
||||||
-> Maybe FilePath
|
-> Maybe FilePath
|
||||||
@ -230,6 +236,9 @@ refreshView mygui myview mfp =
|
|||||||
|
|
||||||
|
|
||||||
-- |Refreshes the View based on the given directory.
|
-- |Refreshes the View based on the given directory.
|
||||||
|
--
|
||||||
|
-- If the directory is not a Dir or a Symlink pointing to a Dir, then
|
||||||
|
-- calls `refreshView` with the 3rd argument being Nothing.
|
||||||
refreshView' :: MyGUI
|
refreshView' :: MyGUI
|
||||||
-> MyView
|
-> MyView
|
||||||
-> AnchoredFile FileInfo
|
-> AnchoredFile FileInfo
|
||||||
@ -254,6 +263,7 @@ refreshView' mygui myview dt@(ADirOrSym _) = do
|
|||||||
ntps <- mapM treeRowReferenceGetPath trs
|
ntps <- mapM treeRowReferenceGetPath trs
|
||||||
mapM_ (treeSelectionSelectPath tvs) ntps
|
mapM_ (treeSelectionSelectPath tvs) ntps
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
|
refreshView' mygui myview (_ :/ Failed{}) = refreshView mygui myview Nothing
|
||||||
refreshView' _ _ _ = return ()
|
refreshView' _ _ _ = return ()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user