diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2015-09-24 04:51:50 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2015-09-24 04:51:50 +0200 |
commit | c2f6a2e5bf40f9e4cb9276bcc9b58ec3627f727a (patch) | |
tree | 77dcdb7c884d32637464f858e0d980376d790f58 /CabalHelper/Common.hs | |
parent | f2bfb9bab04de16e94c8f959c1f5eebe82d6a0aa (diff) |
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.
Diffstat (limited to 'CabalHelper/Common.hs')
-rw-r--r-- | CabalHelper/Common.hs | 9 |
1 files changed, 9 insertions, 0 deletions
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 |