From c2f6a2e5bf40f9e4cb9276bcc9b58ec3627f727a Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Thu, 24 Sep 2015 04:51:50 +0200 Subject: Move package-id to wrapper we need it before dist/setup-config exists so we can't run it as part of the other queries anyways, might as well go in the wrapper. --- CabalHelper/Common.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'CabalHelper/Common.hs') diff --git a/CabalHelper/Common.hs b/CabalHelper/Common.hs index 3a6d4b6..154441e 100644 --- a/CabalHelper/Common.hs +++ b/CabalHelper/Common.hs @@ -86,3 +86,12 @@ runReadP p i = case filter ((=="") . snd) $ readP_to_S p i of appDataDir :: IO FilePath appDataDir = ( "cabal-helper") <$> getAppUserDataDirectory "ghc-mod" + +isCabalFile :: FilePath -> Bool +isCabalFile f = takeExtension' f == ".cabal" + +takeExtension' :: FilePath -> String +takeExtension' p = + if takeFileName p == takeExtension p + then "" -- just ".cabal" is not a valid cabal file + else takeExtension p -- cgit v1.2.3