Move to new HPath API

This commit is contained in:
Julian Ospald 2016-05-09 14:41:57 +02:00
parent dc457eb168
commit 5fc77f6b24
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
5 changed files with 12 additions and 6 deletions

2
3rdparty/hpath vendored

@ -1 +1 @@
Subproject commit 1263fac7ec0d859550bc8145ce63872f15aaebeb Subproject commit 6638cd8cc1f40e3183039186b7c5d4cccc4aa7f7

View File

@ -24,7 +24,6 @@ Installation
git submodule update --init --recursive git submodule update --init --recursive
cabal sandbox init cabal sandbox init
cabal sandbox add-source 3rdparty/hpath cabal sandbox add-source 3rdparty/hpath
cabal sandbox add-source 3rdparty/hpath/3rdparty/posix-paths
cabal sandbox add-source 3rdparty/simple-sendfile cabal sandbox add-source 3rdparty/simple-sendfile
cabal install alex happy cabal install alex happy
export PATH="$(pwd)/.cabal-sandbox/bin:$PATH" export PATH="$(pwd)/.cabal-sandbox/bin:$PATH"

View File

@ -41,7 +41,6 @@ library
hpath, hpath,
mtl >= 2.2, mtl >= 2.2,
old-locale >= 1, old-locale >= 1,
posix-paths,
process, process,
safe, safe,
simple-sendfile, simple-sendfile,
@ -91,7 +90,6 @@ executable hsfm-gtk
hsfm, hsfm,
mtl >= 2.2, mtl >= 2.2,
old-locale >= 1, old-locale >= 1,
posix-paths,
process, process,
safe, safe,
simple-sendfile, simple-sendfile,

View File

@ -54,6 +54,10 @@ import HPath
Abs Abs
, Path , Path
) )
import HPath.IO
(
canonicalizePath
)
import HSFM.Utils.IO import HSFM.Utils.IO
import System.IO.Error import System.IO.Error
( (
@ -204,7 +208,7 @@ throwDestinationInSource :: Path Abs -- ^ source dir
-> IO () -> IO ()
throwDestinationInSource source dest = do throwDestinationInSource source dest = do
dest' <- (\x -> maybe x (\y -> x P.</> y) $ P.basename dest) dest' <- (\x -> maybe x (\y -> x P.</> y) $ P.basename dest)
<$> (P.canonicalizePath $ P.dirname dest) <$> (canonicalizePath $ P.dirname dest)
dids <- forM (P.getAllParents dest') $ \p -> do dids <- forM (P.getAllParents dest') $ \p -> do
fs <- PF.getSymbolicLinkStatus (P.fromAbs p) fs <- PF.getSymbolicLinkStatus (P.fromAbs p)
return (PF.deviceID fs, PF.fileID fs) return (PF.deviceID fs, PF.fileID fs)

View File

@ -37,6 +37,7 @@ import Control.Exception
try try
, SomeException , SomeException
) )
import qualified Data.ByteString as BS
import Data.Foldable import Data.Foldable
( (
for_ for_
@ -76,6 +77,10 @@ import System.INotify
, killINotify , killINotify
, EventVariety(..) , EventVariety(..)
) )
import System.Posix.FilePath
(
pathSeparator
)
@ -303,7 +308,7 @@ refreshView mygui myview mfp =
Item) Item)
case ecd of case ecd of
Right dir -> return (Just $ path dir) Right dir -> return (Just $ path dir)
Left _ -> return (P.parseAbs P.pathSeparator') Left _ -> return (P.parseAbs $ BS.singleton pathSeparator)
-- |Refreshes the View based on the given directory. -- |Refreshes the View based on the given directory.