Tiny refactoring, mostly used as a reminder that '#if blah_platform' tests are
evil and should be replaced by feature-based test (autoconf!) and concentrated
in few modules. System.FilePath is another great example for this, all #ifs
should be replaced by a function handling a possible drive letter + a few
separator constants.
path <- getEnv "PATH"
search (parseSearchPath path)
where
-#ifdef mingw32_TARGET_OS
- fileName = binary `joinFileExt` "exe"
-#else
- fileName = binary
-#endif
+ fileName = binary `joinFileExt` drop 1 exeExt
search :: [FilePath] -> IO (Maybe FilePath)
search [] = return Nothing
if b then return (Just path)
else search ds
+-- ToDo: This should be determined via autoconf (AC_EXEEXT)
+exeExt :: String
+#ifdef mingw32_TARGET_OS
+exeExt = ".exe"
+#else
+exeExt = ""
+#endif
+
#ifdef __GLASGOW_HASKELL__
{- |@'getDirectoryContents' dir@ returns a list of /all/ entries
in /dir/.