Skip to content

Commit 2607ff9

Browse files
Fix ambiguous data files on duplicate idir
When library and simulator code share the same hs-source-dirs, clash fails to resolve data file with the following error: Multiple data files for "font.bin" found. The following candidates were found: ["./font.bin","./font.bin"] This change fix that bug by removing duplicated source dirs.
1 parent d0f65c4 commit 2607ff9

File tree

1 file changed

+2
-1
lines changed
  • clash-lib/src/Clash/Netlist/BlackBox

1 file changed

+2
-1
lines changed

clash-lib/src/Clash/Netlist/BlackBox/Util.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import Control.Monad.State (State, StateT (..), lift, gets
4646
import Data.Bitraversable (bitraverse)
4747
import Data.Bool (bool)
4848
import Data.Coerce (coerce)
49+
import Data.Containers.ListUtils (nubOrd)
4950
import Data.Foldable (foldrM)
5051
import Data.Hashable (Hashable (..))
5152
import qualified Data.HashMap.Strict as HashMap
@@ -332,7 +333,7 @@ canonicalizeDataFilePath idirs toCanonicalize
332333
(canonicalizePath toCanonicalize)
333334
(error [I.i|Could not find data file #{show toCanonicalize}. Does it exist?|])
334335
| otherwise = unsafePerformIO $ do
335-
let candidates = map (</> toCanonicalize) idirs
336+
let candidates = map (</> toCanonicalize) (nubOrd idirs)
336337
found <- filterM doesFileExist candidates
337338
case found of
338339
[] -> error [I.i|

0 commit comments

Comments
 (0)