summaryrefslogtreecommitdiff
path: root/Utility/DiskFree.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Utility/DiskFree.hs')
-rw-r--r--Utility/DiskFree.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Utility/DiskFree.hs b/Utility/DiskFree.hs
index 453244175..20911dd06 100644
--- a/Utility/DiskFree.hs
+++ b/Utility/DiskFree.hs
@@ -5,7 +5,7 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE ForeignFunctionInterface, CPP #-}
module Utility.DiskFree ( getDiskFree ) where
@@ -15,6 +15,8 @@ import Foreign.C.Types
import Foreign.C.String
import Foreign.C.Error
+#ifdef WITH_CLIBS
+
foreign import ccall safe "libdiskfree.h diskfree" c_diskfree
:: CString -> IO CULLong
@@ -27,3 +29,10 @@ getDiskFree path = withFilePath path $ \c_path -> do
)
where
safeErrno (Errno v) = v == 0
+
+#else
+
+getDiskFree :: FilePath -> IO (Maybe Integer)
+getDiskFree _ = return Nothing
+
+#endif