Skip to content

Commit 48c33ba

Browse files
committed
Fix package .
1 parent 6c0a91c commit 48c33ba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Hie/Locate.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import Hie.Yaml
2626
import System.Directory
2727
import System.FilePath.Posix
2828
import System.FilePattern.Directory (getDirectoryFiles)
29+
import Debug.Trace
2930

3031
newtype Pkgs = Pkgs [FilePath]
3132
deriving (Eq, Ord)
@@ -49,15 +50,16 @@ cabalPkgs p = do
4950
[] -> fail "no cabal files found"
5051
h : _ -> pure [p </> h]
5152
xs -> do
52-
cd <- liftIO $ map (p </>) <$> getDirectoryFiles p (map (matchDirs . T.unpack) xs)
53+
cd <- liftIO $ map (p </>) <$> getDirectoryFiles p (map (matchDirs . traceShowId . T.unpack) xs)
5354
cf <-
5455
liftIO $
5556
mapM (\p -> if takeExtension p == ".cabal" then pure [p] else cfs p) cd
5657
pure $ concat cf
5758
where
5859
cabalP n = liftIO (try $ T.readFile $ p </> n :: IO (Either IOException T.Text))
5960
cfs d = filter ((".cabal" ==) . takeExtension) <$> listDirectory d
60-
matchDirs p | "/" `isSuffixOf` p = p <> "*.cabal"
61+
matchDirs "." = "./*.cabal"
62+
matchDirs p | "/" `isSuffixOf` p || p == "." = p <> "*.cabal"
6163
matchDirs p | "*" `isSuffixOf` p || takeExtension p == "" = p <> "/*.cabal"
6264
matchDirs p = p
6365

0 commit comments

Comments
 (0)