Merge branch 'master' into ospath

This commit is contained in:
Joey Hess 2025-01-24 12:02:35 -04:00
commit 8021d22955
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
14 changed files with 79 additions and 10 deletions

View file

@ -189,6 +189,6 @@ winLockFile pid pidfile = do
prefix = pidfile ++ "."
suffix = ".lck"
cleanstale = mapM_ (void . tryIO . removeFile) =<<
(filter iswinlockfile <$> dirContents (fromRawFilePath (parentDir (toRawFilePath pidfile))))
(filter iswinlockfile . map fromRawFilePath <$> dirContents (parentDir (toRawFilePath pidfile)))
iswinlockfile f = suffix `isSuffixOf` f && prefix `isPrefixOf` f
#endif

View file

@ -70,7 +70,8 @@ watchDir dir ignored scanevents hooks = do
scan d = unless (ignoredPath ignored d) $
-- Do not follow symlinks when scanning.
-- This mirrors the inotify startup scan behavior.
mapM_ go =<< emptyWhenDoesNotExist (dirContentsRecursiveSkipping (const False) False d)
mapM_ (go . fromRawFilePath) =<< emptyWhenDoesNotExist
(dirContentsRecursiveSkipping (const False) False (toRawFilePath d))
where
go f
| ignoredPath ignored f = noop

View file

@ -43,7 +43,8 @@ watchDir dir ignored scanevents hooks = do
runhook h s = maybe noop (\a -> a (filePath evt) s) (h hooks)
scan d = unless (ignoredPath ignored d) $
mapM_ go =<< emptyWhenDoesNotExist (dirContentsRecursiveSkipping (const False) False d)
mapM_ (go . fromRawFilePath) =<< emptyWhenDoesNotExist
(dirContentsRecursiveSkipping (const False) False (toRawFilePath d))
where
go f
| ignoredPath ignored f = noop

View file

@ -19,7 +19,6 @@ module Utility.Directory.Stream (
import Control.Monad
import Control.Concurrent
import qualified Data.ByteString as B
import Data.Maybe
import Prelude
@ -27,6 +26,7 @@ import Prelude
import qualified System.Win32 as Win32
import System.FilePath
#else
import qualified Data.ByteString as B
import qualified System.Posix.Directory.ByteString as Posix
#endif

View file

@ -36,7 +36,6 @@ import System.File.OsPath
import Utility.Path.Windows
import Utility.OsPath
import System.IO (IO, Handle, IOMode)
import System.OsPath (OsPath)
import qualified System.File.OsPath as O
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L

View file

@ -17,7 +17,6 @@ module Utility.FileSize (
#ifdef mingw32_HOST_OS
import Control.Exception (bracket)
import System.IO
import Utility.FileSystemEncoding
import qualified Utility.FileIO as F
import Utility.OsPath
#else

View file

@ -179,10 +179,10 @@ feedRead cmd params passphrase feeder reader = do
go (passphrasefd ++ params)
#else
-- store the passphrase in a temp file for gpg
withTmpFile "gpg" $ \tmpfile h -> do
withTmpFile (toOsPath "gpg") $ \tmpfile h -> do
liftIO $ B.hPutStr h passphrase
liftIO $ hClose h
let passphrasefile = [Param "--passphrase-file", File tmpfile]
let passphrasefile = [Param "--passphrase-file", File (fromosPath tmpfile)]
go $ passphrasefile ++ params
#endif
where

View file

@ -75,9 +75,9 @@ openLock sharemode f = do
return $ if h == iNVALID_HANDLE_VALUE
then Nothing
else Just h
#endif
where
security_attributes = maybePtr Nothing
#endif
dropLock :: LockHandle -> IO ()
dropLock = closeHandle

View file

@ -163,7 +163,7 @@ feedRead cmd subcmd params password emptydirectory feeder reader = do
withTmpFile (toOsPath "sop") $ \tmpfile h -> do
liftIO $ B.hPutStr h password
liftIO $ hClose h
let passwordfile = [Param $ "--with-password="++tmpfile]
let passwordfile = [Param $ "--with-password=" ++ fromOsPath tmpfile]
-- Don't need to pass emptydirectory since @FD is not used,
-- and so tmpfile also does not need to be made absolute.
case emptydirectory of