[[!comment format=mdwn
 username="jkniiv"
 avatar="http://cdn.libravatar.org/avatar/05fd8b33af7183342153e8013aa3713d"
 subject="ok, that didn't quite resolve it"
 date="2023-03-04T19:15:31Z"
 content="""
@Joey, unfortunately commit [[!commit 398633c12bfb6201ba1fcd9b50e5e8055bfff89e]] wasn't quite enough to
resolve my issue. :) First of all I wondered why you would employ `fromRawFilePath` instead of `toRawFilePath`
considering that the argument of `getstatus` seems to be a FilePath, and indeed Utility.DirWatcher.Win32Notify
didn't compile without replacing the former with the latter. Also you didn't notice that I had changed a qualified
import into a regular one because otherwise `isRegularFile` wouldn't be available.

Here's the tail end of my build log trying to build commit 398633c12:

[[!format sh \"\"\"
jkniiv@AINESIS MINGW64 /c/annx
$ tail -n 35 stack.build.LOG~102
[150 of 676] Compiling Utility.DirWatcher.Win32Notify

Utility\DirWatcher\Win32Notify.hs:55:51: error:
    * Variable not in scope: isRegularFile :: FileStatus -> Bool
    * Perhaps you meant `System.PosixCompat.Files.isRegularFile' (imported from System.PosixCompat.Files)
   |
55 |                                                 | isRegularFile s ->

   |                                                   ^^^^^^^^^^^^^

Utility\DirWatcher\Win32Notify.hs:63:54: error:
    * Couldn't match type `[Char]'
                     with `Data.ByteString.Internal.ByteString'
      Expected type: RawFilePath -> RawFilePath
        Actual type: RawFilePath -> FilePath
    * In the second argument of `(.)', namely `fromRawFilePath'
      In the second argument of `(.)', namely
        `R.getFileStatus . fromRawFilePath'
      In the expression: catchMaybeIO . R.getFileStatus . fromRawFilePath
   |
63 |         getstatus = catchMaybeIO . R.getFileStatus . fromRawFilePath

   |                                                      ^^^^^^^^^^^^^^^


Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the following errors:

       [S-7011]
       While building package git-annex-10.20230227 (scroll up to its section to see the error)
       using:
       C:\Users\jkniiv\Projektit\git-annex.branchable.com\git-annex--BUILD-230304-398633c12\.stack-work\dist\274b403a\setup\setup --verbose=1 --builddir=.stack-work\dist\274b403a build exe:git-annex --ghc-options \" -fdiagnostics-color=always\"
       Process exited with code: ExitFailure 1

\"\"\"]]

So, I ended up with the following simple fix (although this situation left me wondering if `watchDir` ought to
be rewritten to deal with RawFilePaths directly but then that's beyond my abilities):

[[!format diff \"\"\"
diff --git a/Utility/DirWatcher/Win32Notify.hs b/Utility/DirWatcher/Win32Notify.hs
index a6a7e4ce9..0b02053c9 100644
--- a/Utility/DirWatcher/Win32Notify.hs
+++ b/Utility/DirWatcher/Win32Notify.hs
@@ -12,7 +12,7 @@ import Utility.DirWatcher.Types
 import qualified Utility.RawFilePath as R

 import System.Win32.Notify
-import qualified System.PosixCompat.Files (isRegularFile)
+import System.PosixCompat.Files (isRegularFile)

 watchDir :: FilePath -> (FilePath -> Bool) -> Bool -> WatchHooks -> IO WatchManager
 watchDir dir ignored scanevents hooks = do
@@ -60,7 +60,7 @@ watchDir dir ignored scanevents hooks = do
                  where
                        runhook h s = maybe noop (\a -> a f s) (h hooks)

-       getstatus = catchMaybeIO . R.getFileStatus . fromRawFilePath
+       getstatus = catchMaybeIO . R.getFileStatus . toRawFilePath

 {- Check each component of the path to see if it's ignored. -}
 ignoredPath :: (FilePath -> Bool) -> FilePath -> Bool
\"\"\"]]

"""]]
