From f0b9b46cb24d0cd729d52a44ba2e21ded6b29d56 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Jan 2025 11:37:17 -0400 Subject: [PATCH] windows and osx build fixes for recent ByteString conversion work --- Utility/Daemon.hs | 2 +- Utility/DirWatcher/FSEvents.hs | 3 ++- Utility/DirWatcher/Win32Notify.hs | 3 ++- Utility/Gpg.hs | 4 ++-- Utility/StatelessOpenPGP.hs | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs index c2a3d1bde7..38f8d09aee 100644 --- a/Utility/Daemon.hs +++ b/Utility/Daemon.hs @@ -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 diff --git a/Utility/DirWatcher/FSEvents.hs b/Utility/DirWatcher/FSEvents.hs index 7b6be6f13b..da2b3194bc 100644 --- a/Utility/DirWatcher/FSEvents.hs +++ b/Utility/DirWatcher/FSEvents.hs @@ -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 diff --git a/Utility/DirWatcher/Win32Notify.hs b/Utility/DirWatcher/Win32Notify.hs index e5ce316ce6..5f53c13bf5 100644 --- a/Utility/DirWatcher/Win32Notify.hs +++ b/Utility/DirWatcher/Win32Notify.hs @@ -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 diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs index 19dd7f5395..763028e7dc 100644 --- a/Utility/Gpg.hs +++ b/Utility/Gpg.hs @@ -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 diff --git a/Utility/StatelessOpenPGP.hs b/Utility/StatelessOpenPGP.hs index 6150bce633..874ed84e19 100644 --- a/Utility/StatelessOpenPGP.hs +++ b/Utility/StatelessOpenPGP.hs @@ -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