From b8fb0a0a96de36ab088e29f816f89b4e9b52916f Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 30 Jan 2013 09:20:47 +0000 Subject: cope with missing telldir/seekdir (for Android) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submitted by: Nathan Hüsken --- System/Posix/Directory/ByteString.hsc | 4 ++++ System/Posix/Directory/Common.hsc | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'System/Posix/Directory') diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc index 3ac642b..bb9100c 100644 --- a/System/Posix/Directory/ByteString.hsc +++ b/System/Posix/Directory/ByteString.hsc @@ -29,8 +29,12 @@ module System.Posix.Directory.ByteString ( rewindDirStream, closeDirStream, DirStreamOffset, +#ifdef HAVE_TELLDIR tellDirStream, +#endif +#ifdef HAVE_SEEKDIR seekDirStream, +#endif -- * The working dirctory getWorkingDirectory, diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc index a608be3..7e2dfc6 100644 --- a/System/Posix/Directory/Common.hsc +++ b/System/Posix/Directory/Common.hsc @@ -22,8 +22,12 @@ module System.Posix.Directory.Common ( DirStream(..), CDir, CDirent, DirStreamOffset(..), rewindDirStream, closeDirStream, +#ifdef HAVE_SEEKDIR seekDirStream, +#endif +#ifdef HAVE_TELLDIR tellDirStream, +#endif changeWorkingDirectoryFd, ) where @@ -57,13 +61,16 @@ foreign import ccall unsafe "closedir" newtype DirStreamOffset = DirStreamOffset COff +#ifdef HAVE_SEEKDIR seekDirStream :: DirStream -> DirStreamOffset -> IO () seekDirStream (DirStream dirp) (DirStreamOffset off) = c_seekdir dirp off foreign import ccall unsafe "seekdir" c_seekdir :: Ptr CDir -> COff -> IO () +#endif +#ifdef HAVE_TELLDIR tellDirStream :: DirStream -> IO DirStreamOffset tellDirStream (DirStream dirp) = do off <- c_telldir dirp @@ -71,6 +78,7 @@ tellDirStream (DirStream dirp) = do foreign import ccall unsafe "telldir" c_telldir :: Ptr CDir -> IO COff +#endif changeWorkingDirectoryFd :: Fd -> IO () changeWorkingDirectoryFd (Fd fd) = -- cgit v1.2.3