windows disk free space checking
This commit is contained in:
parent
8699a36438
commit
063a183a61
4 changed files with 22 additions and 12 deletions
|
@ -31,8 +31,18 @@ getDiskFree path = withFilePath path $ \c_path -> do
|
|||
safeErrno (Errno v) = v == 0
|
||||
|
||||
#else
|
||||
#ifdef mingw32_HOST_OS
|
||||
|
||||
import System.Win32.File
|
||||
|
||||
getDiskFree :: FilePath -> IO (Maybe Integer)
|
||||
getDiskFree path = catchMaybeIO $ do
|
||||
(sectors, bytes, nfree, _ntotal) <- getDiskFreeSpace (Just path)
|
||||
return $ toInteger sectors * toInteger bytes * toInteger nfree
|
||||
#else
|
||||
|
||||
getDiskFree :: FilePath -> IO (Maybe Integer)
|
||||
getDiskFree _ = return Nothing
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue