Skip to content

Commit b85bcca

Browse files
committed
filter prefixes properly based on (#193)
1 parent a15d6d3 commit b85bcca

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/StaticLS/FilePath.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ subRootExtensionFilepathUnchecked removeParents addParent extension targetPath =
4242
let
4343
-- Normalize to absolute paths to drop the prefix
4444
noPrefixSrcPath =
45-
List.foldl' (\path parent -> Path.makeRelative parent path) targetPath removeParents
45+
case filter (\parent -> parent.path `List.isPrefixOf` targetPath.path) removeParents of
46+
(parent:_) -> Path.makeRelative parent targetPath
47+
[] -> targetPath
4648
-- Set the directory path and substitute the file extension
4749
newPath = addParent Path.</> noPrefixSrcPath Path.-<.> extension
4850
in

0 commit comments

Comments
 (0)