{-# LINE 1 "libraries/unix/System/Posix/ByteString/FilePath.hsc" #-}{-# LINE 2 "libraries/unix/System/Posix/ByteString/FilePath.hsc" #-}{-# LANGUAGE Trustworthy #-}{-# LINE 4 "libraries/unix/System/Posix/ByteString/FilePath.hsc" #-}------------------------------------------------------------------------------- |-- Module : System.Posix.ByteString.FilePath-- Copyright : (c) The University of Glasgow 2002-- License : BSD-style (see the file libraries/base/LICENSE)-- -- Maintainer : libraries@haskell.org-- Stability : provisional-- Portability : non-portable (requires POSIX)---- Internal stuff: support for ByteString FilePaths-------------------------------------------------------------------------------moduleSystem.Posix.ByteString.FilePath(RawFilePath,withFilePath,peekFilePath,peekFilePathLen,throwErrnoPathIfMinus1Retry,throwErrnoPathIfMinus1Retry_,throwErrnoPathIfNullRetry,throwErrnoPathIfRetry,throwErrnoPath,throwErrnoPathIf,throwErrnoPathIf_,throwErrnoPathIfNull,throwErrnoPathIfMinus1,throwErrnoPathIfMinus1_)whereimportForeignhiding(void)importForeign.Chiding(throwErrnoPath,throwErrnoPathIf,throwErrnoPathIf_,throwErrnoPathIfNull,throwErrnoPathIfMinus1,throwErrnoPathIfMinus1_)importControl.MonadimportData.ByteStringimportData.ByteString.Char8asBCimportPreludehiding(FilePath)-- | A literal POSIX file pathtypeRawFilePath=ByteStringwithFilePath::RawFilePath->(CString->IOa)->IOawithFilePath=useAsCStringpeekFilePath::CString->IORawFilePathpeekFilePath=packCStringpeekFilePathLen::CStringLen->IORawFilePathpeekFilePathLen=packCStringLenthrowErrnoPathIfMinus1Retry::(Eqa,Numa)=>String->RawFilePath->IOa->IOathrowErrnoPathIfMinus1Retrylocpathf=dothrowErrnoPathIfRetry(==-1)locpathfthrowErrnoPathIfMinus1Retry_::(Eqa,Numa)=>String->RawFilePath->IOa->IO()throwErrnoPathIfMinus1Retry_locpathf=void$throwErrnoPathIfRetry(==-1)locpathfthrowErrnoPathIfNullRetry::String->RawFilePath->IO(Ptra)->IO(Ptra)throwErrnoPathIfNullRetrylocpathf=throwErrnoPathIfRetry(==nullPtr)locpathfthrowErrnoPathIfRetry::(a->Bool)->String->RawFilePath->IOa->IOathrowErrnoPathIfRetryprlocrpathf=dores<-fifprresthendoerr<-getErrnoiferr==eINTRthenthrowErrnoPathIfRetryprlocrpathfelsethrowErrnoPathlocrpathelsereturnres-- | as 'throwErrno', but exceptions include the given path when appropriate.--throwErrnoPath::String->RawFilePath->IOathrowErrnoPathlocpath=doerrno<-getErrnoioError(errnoToIOErrorlocerrnoNothing(Just(BC.unpackpath)))-- | as 'throwErrnoIf', but exceptions include the given path when-- appropriate.--throwErrnoPathIf::(a->Bool)->String->RawFilePath->IOa->IOathrowErrnoPathIfcondlocpathf=dores<-fifcondresthenthrowErrnoPathlocpathelsereturnres-- | as 'throwErrnoIf_', but exceptions include the given path when-- appropriate.--throwErrnoPathIf_::(a->Bool)->String->RawFilePath->IOa->IO()throwErrnoPathIf_condlocpathf=void$throwErrnoPathIfcondlocpathf-- | as 'throwErrnoIfNull', but exceptions include the given path when-- appropriate.--throwErrnoPathIfNull::String->RawFilePath->IO(Ptra)->IO(Ptra)throwErrnoPathIfNull=throwErrnoPathIf(==nullPtr)-- | as 'throwErrnoIfMinus1', but exceptions include the given path when-- appropriate.--throwErrnoPathIfMinus1::(Eqa,Numa)=>String->RawFilePath->IOa->IOathrowErrnoPathIfMinus1=throwErrnoPathIf(==-1)-- | as 'throwErrnoIfMinus1_', but exceptions include the given path when-- appropriate.--throwErrnoPathIfMinus1_::(Eqa,Numa)=>String->RawFilePath->IOa->IO()throwErrnoPathIfMinus1_=throwErrnoPathIf_(==-1)