aboutsummaryrefslogtreecommitdiff
path: root/CabalHelper/Common.hs
diff options
context:
space:
mode:
Diffstat (limited to 'CabalHelper/Common.hs')
-rw-r--r--CabalHelper/Common.hs9
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