Skip to content

Commit 85ba996

Browse files
committed
Fix cddlc paths
1 parent f49e846 commit 85ba996

File tree

1 file changed

+13
-10
lines changed
  • ouroboros-consensus-cardano/test/cardano-test/Test/Consensus/Cardano

1 file changed

+13
-10
lines changed

ouroboros-consensus-cardano/test/cardano-test/Test/Consensus/Cardano/GenCDDLs.hs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ setupCDDLCEnv = do
9595
babbage <- map takePath <$> Babbage.readBabbageCddlFileNames
9696
conway <- map takePath <$> Conway.readConwayCddlFileNames
9797

98-
localDataDir <- takePath <$> getDataDir
98+
localDataDir <- windowsPathHack <$> getDataDir
9999
let local_paths =
100100
map
101101
(localDataDir F.</>)
@@ -135,22 +135,25 @@ cddlc dataFile = do
135135
where
136136
red s = putStrLn $ "\ESC[31m" <> s <> "\ESC[0m"
137137

138-
takePath :: FilePath -> FilePath
139-
takePath x =
138+
-- | @cddlc@ is not capable of using backlashes
139+
--
140+
-- @cddlc@ mixes @C:@ with the separator in @CDDL_INCLUDE_PATH@, and it
141+
-- doesn't understand @;@ as a separator. It works if we remove @C:@ and we
142+
-- are running in the same drive as the cddl files.
143+
windowsPathHack :: FilePath -> FilePath
144+
windowsPathHack x =
140145
#ifdef mingw32_HOST_OS
141-
-- @cddlc@ is not capable of using backlashes
142-
--
143-
-- @cddlc@ mixes @C:@ with the separator in @CDDL_INCLUDE_PATH@, and it
144-
-- doesn't understand @;@ as a separator. It works if we remove @C:@ and we
145-
-- are running in the same drive as the cddl files.
146-
let f = [ if c /= '\\' then c else '/' | c <- F.takeDirectory x ]
146+
let f = [ if c /= '\\' then c else '/' | c <- x ]
147147
in if "C:" `L.isPrefixOf` f
148148
then drop 2 f
149149
else f
150150
#else
151-
F.takeDirectory x
151+
x
152152
#endif
153153

154+
takePath :: FilePath -> FilePath
155+
takePath = windowsPathHack . F.takeDirectory
156+
154157
probeTools :: IO ()
155158
probeTools = do
156159
putStrLn "Probing tools:"

0 commit comments

Comments
 (0)