diff options
author | Ben Sima <ben@bsima.me> | 2023-01-05 16:56:50 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-01-05 16:56:50 -0500 |
commit | 80e4894d6207658099a32266e05fb4ebaf99f3d0 (patch) | |
tree | 461d10ecf24c1ec09318627e6930326abd66ef44 /Biz/Bild.hs | |
parent | 91b5be1a49c9f2a09fa273722d94cf4c60606214 (diff) |
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.
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r-- | Biz/Bild.hs | 12 |
1 files 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 |