LIB/GTK: use fullPathS

This commit is contained in:
Julian Ospald 2016-03-31 00:25:03 +02:00
parent 74a48b2668
commit 5e232e3d4a
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 16 additions and 16 deletions

View File

@ -226,7 +226,7 @@ recreateSymlink _ _ AFileInvFN = throw InvalidFileName
recreateSymlink cm symf@(_ :/ SymLink {})
symdest@(_ :/ Dir {})
= do
sympoint <- readSymbolicLink (P.fromAbs . fullPath $ symf)
sympoint <- readSymbolicLink (fullPathS $ symf)
let symname = fullPath symdest P.</> (name . file $ symf)
case cm of
Merge -> delOld symname
@ -264,8 +264,8 @@ overwriteFile _ AFileInvFN = throw InvalidFileName
overwriteFile from@(_ :/ RegFile {})
to@(_ :/ RegFile {})
= do
let from' = P.fromAbs . fullPath $ from
to' = P.fromAbs . fullPath $ to
let from' = fullPathS from
to' = fullPathS to
throwSameFile from' to'
copyFile' from' to'
overwriteFile _ _ = throw $ InvalidOperation "wrong input type"
@ -282,7 +282,7 @@ copyFileToDir _ _ AFileInvFN = throw InvalidFileName
copyFileToDir cm from@(_ :/ RegFile fn _)
to@(_ :/ Dir {})
= do
let from' = P.fromAbs . fullPath $ from
let from' = fullPathS from
to' = P.fromAbs (fullPath to P.</> fn)
case cm of
Strict -> throwFileDoesExist to'
@ -382,7 +382,7 @@ easyDelete _ = throw $ InvalidOperation "wrong input type"
openFile :: AnchoredFile a
-> IO ProcessHandle
openFile AFileInvFN = throw InvalidFileName
openFile f = spawnProcess "xdg-open" [P.fromAbs . fullPath $ f]
openFile f = spawnProcess "xdg-open" [fullPathS f]
-- |Executes a program with the given arguments.
@ -391,7 +391,7 @@ executeFile :: AnchoredFile FileInfo -- ^ program
-> IO ProcessHandle
executeFile AFileInvFN _ = throw InvalidFileName
executeFile prog@(_ :/ RegFile {}) args
= spawnProcess (P.fromAbs . fullPath $ prog) args
= spawnProcess (fullPathS prog) args
executeFile _ _ = throw $ InvalidOperation "wrong input type"
@ -434,7 +434,7 @@ renameFile :: AnchoredFile FileInfo -> Path Fn -> IO ()
renameFile AFileInvFN _ = throw InvalidFileName
renameFile _ InvFN = throw InvalidFileName
renameFile af (ValFN fn) = do
let fromf = P.fromAbs . fullPath $ af
let fromf = fullPathS af
tof = P.fromAbs (anchor af P.</> fn)
throwFileDoesExist tof
throwSameFile fromf tof
@ -451,7 +451,7 @@ moveFile _ AFileInvFN _ = throw InvalidFileName
moveFile _ _ AFileInvFN = throw InvalidFileName
moveFile cm from to@(_ :/ Dir {}) = do
let from' = fullPath from
froms' = P.fromAbs . fullPath $ from
froms' = fullPathS from
to' = fullPath to P.</> (name . file $ from)
tos' = P.fromAbs (fullPath to P.</> (name . file $ from))
case cm of

View File

@ -241,7 +241,7 @@ execute _ _ _ = withErrorDialog
-- |Supposed to be used with 'withRows'. Deletes a file or directory.
del :: [Item] -> MyGUI -> MyView -> IO ()
del [item] mygui myview = withErrorDialog $ do
let cmsg = "Really delete \"" ++ P.fromAbs (fullPath item) ++ "\"?"
let cmsg = "Really delete \"" ++ fullPathS item ++ "\"?"
withConfirmationDialog cmsg
$ easyDelete item
-- this throws on the first error that occurs
@ -258,7 +258,7 @@ del _ _ _ = withErrorDialog
moveInit :: [Item] -> MyGUI -> MyView -> IO ()
moveInit [item] mygui myview = do
writeTVarIO (operationBuffer myview) (FMove . MP1 $ item)
let sbmsg = "Move buffer: " ++ P.fromAbs (fullPath item)
let sbmsg = "Move buffer: " ++ fullPathS item
popStatusbar mygui
void $ pushStatusBar mygui sbmsg
moveInit _ _ _ = withErrorDialog
@ -269,7 +269,7 @@ moveInit _ _ _ = withErrorDialog
copyInit :: [Item] -> MyGUI -> MyView -> IO ()
copyInit [item] mygui myview = do
writeTVarIO (operationBuffer myview) (FCopy . CP1 $ item)
let sbmsg = "Copy buffer: " ++ P.fromAbs (fullPath item)
let sbmsg = "Copy buffer: " ++ fullPathS item
popStatusbar mygui
void $ pushStatusBar mygui sbmsg
copyInit _ _ _ = withErrorDialog
@ -284,14 +284,14 @@ operationFinal mygui myview = withErrorDialog $ do
cdir <- getCurrentDir myview
case op of
FMove (MP1 s) -> do
let cmsg = "Really move \"" ++ P.fromAbs (fullPath s)
++ "\"" ++ " to \"" ++ P.fromAbs (fullPath cdir) ++ "\"?"
let cmsg = "Really move \"" ++ fullPathS s
++ "\"" ++ " to \"" ++ fullPathS cdir ++ "\"?"
withConfirmationDialog cmsg . withCopyModeDialog
$ \cm -> void $ runFileOp (FMove . MC s cdir $ cm)
return ()
FCopy (CP1 s) -> do
let cmsg = "Really copy \"" ++ P.fromAbs (fullPath s)
++ "\"" ++ " to \"" ++ P.fromAbs (fullPath cdir) ++ "\"?"
let cmsg = "Really copy \"" ++ fullPathS s
++ "\"" ++ " to \"" ++ fullPathS cdir ++ "\"?"
withConfirmationDialog cmsg . withCopyModeDialog
$ \cm -> void $ runFileOp (FCopy . CC s cdir $ cm)
return ()
@ -323,7 +323,7 @@ renameF [item] mygui myview = withErrorDialog $ do
mfn <- textInputDialog "Enter new file name"
let pmfn = P.parseFn =<< mfn
for_ pmfn $ \fn -> do
let cmsg = "Really rename \"" ++ P.fromAbs (fullPath item)
let cmsg = "Really rename \"" ++ fullPathS item
++ "\"" ++ " to \"" ++ P.fromAbs (anchor item P.</> fn) ++ "\"?"
withConfirmationDialog cmsg $
HSFM.FileSystem.FileOperations.renameFile item fn