2016-02-15 15:13:26 +00:00
|
|
|
{- portability shim for System.MountPoints
|
|
|
|
-
|
|
|
|
- Copyright 2016 Joey Hess <id@joeyh.name>
|
|
|
|
-
|
|
|
|
- License: BSD-2-clause
|
|
|
|
-}
|
|
|
|
|
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
|
|
|
|
|
|
|
module Utility.Mounts (getMounts, Mntent(..)) where
|
|
|
|
|
|
|
|
import qualified System.MountPoints
|
|
|
|
import System.MountPoints (Mntent(..))
|
|
|
|
|
2018-04-25 21:42:27 +00:00
|
|
|
import Utility.Exception
|
|
|
|
|
2016-02-15 15:13:26 +00:00
|
|
|
getMounts :: IO [Mntent]
|
|
|
|
#ifndef __ANDROID__
|
|
|
|
getMounts = System.MountPoints.getMounts
|
2018-04-25 21:42:27 +00:00
|
|
|
-- That will crash when running on Android, so fall back to this.
|
|
|
|
`catchNonAsync` const System.MountPoints.getProcMounts
|
2016-02-15 15:13:26 +00:00
|
|
|
#else
|
|
|
|
getMounts = System.MountPoints.getProcMounts
|
|
|
|
#endif
|