summaryrefslogtreecommitdiff
path: root/Utility/DiskFree.hs
blob: fe3a4577c1360a5788ea776118029553a4d0d9a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{- disk free space checking shim
 -
 - Copyright 2016 Joey Hess <id@joeyh.name>
 -
 - License: BSD-2-clause
 -}

{-# OPTIONS_GHC -fno-warn-tabs #-}

module Utility.DiskFree (
	getDiskFree,
	getDiskSize
) where

import System.DiskSpace
import Utility.Applicative
import Utility.Exception

getDiskFree :: FilePath -> IO (Maybe Integer)
getDiskFree = catchMaybeIO . getAvailSpace

getDiskSize :: FilePath -> IO (Maybe Integer)
getDiskSize = fmap diskTotal <$$> catchMaybeIO . getDiskUsage