on master help sign in
Fix issue where relative paths aren't parsed correctly for JS %lib includes
2fdf342Risto Stevcev
src/IRTS/JavaScript/Codegen.hs+4−1
@@ -84,8 +84,11 @@ includeLibs =
84 repl '\\' = '_'
84 repl '\\' = '_'
85 repl '/' = '_'
85 repl '/' = '_'
86 repl c = c
86 repl c = c
87+
88+ trimPeriod ('.' : xs) = '_' : xs
89+ trimPeriod s = s
87 in
90 in
88− concatMap (\lib -> "var " ++ (repl <$> lib) ++ " = require(\"" ++ lib ++"\");\n")
91+ concatMap (\lib -> "var " ++ (trimPeriod $ repl <$> lib) ++ " = require(\"" ++ lib ++"\");\n")
89
92
90isYes :: Maybe String -> Bool
93isYes :: Maybe String -> Bool
91isYes (Just "Y") = True
94isYes (Just "Y") = True