From 80e4894d6207658099a32266e05fb4ebaf99f3d0 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 5 Jan 2023 16:56:50 -0500 Subject: Fix a bug where I couldn't bild from a subdir I need to use the absPath, and the `makeAbsolute` function doesn't actually verify that the path is correct, it just prepends the CWD to the given path. --- Biz/Bild.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Biz/Bild.hs b/Biz/Bild.hs index e2f1ef1..85b62db 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -357,17 +357,17 @@ analyze hmap ns = case Map.lookup ns hmap of analyzeOne :: Namespace -> IO (Maybe Target) analyzeOne namespace@(Namespace _ ext) = do let path = Namespace.toPath namespace - contentLines <- - withFile path ReadMode <| \h -> - IO.hSetEncoding h IO.utf8_bom - >> Text.IO.hGetContents h - /> Text.lines root <- Env.getEnv "BIZ_ROOT" - absPath <- Dir.makeAbsolute path + let absPath = root path user <- Env.getEnv "USER" /> Text.pack host <- Env.lookupEnv "HOSTNAME" /> fromMaybe "interactive" /> Text.pack Log.info ["bild", "analyze", str path] let runw cmd args = Process.readProcess cmd args "" /> Text.pack /> Text.words + contentLines <- + withFile absPath ReadMode <| \h -> + IO.hSetEncoding h IO.utf8_bom + >> Text.IO.hGetContents h + /> Text.lines case ext of -- basically we don't support building these Namespace.Css -> pure Nothing -- cgit v1.2.3