{-# LINE 1 "System/Environment/ExecutablePath.hsc" #-}{-# LANGUAGE Safe #-}{-# LANGUAGE CPP #-}------------------------------------------------------------------------------- |-- Module : System.Environment.ExecutablePath-- Copyright : (c) The University of Glasgow 2001-- License : BSD-style (see the file libraries/base/LICENSE)---- Maintainer : libraries@haskell.org-- Stability : provisional-- Portability : portable---- Function to retrieve the absolute filepath of the current executable.---- @since 4.6.0.0-----------------------------------------------------------------------------moduleSystem.Environment.ExecutablePath(getExecutablePath)where-- The imports are purposely kept completely disjoint to prevent edits-- to one OS implementation from breaking another.{-# LINE 32 "System/Environment/ExecutablePath.hsc" #-}importForeign.CimportForeign.Marshal.ArrayimportSystem.Posix.Internals{-# LINE 48 "System/Environment/ExecutablePath.hsc" #-}-- The exported function is defined outside any if-guard to make sure-- every OS implements it with the same type.-- | Returns the absolute pathname of the current executable.---- Note that for scripts and interactive sessions, this is the path to-- the interpreter (e.g. ghci.)---- @since 4.6.0.0getExecutablePath::IOFilePath---------------------------------------------------------------------------------- Mac OS X{-# LINE 109 "System/Environment/ExecutablePath.hsc" #-}foreignimportccallunsafe"readlink"c_readlink::CString->CString->CSize->IOCInt-- | Reads the @FilePath@ pointed to by the symbolic link and returns-- it.---- See readlink(2)readSymbolicLink::FilePath->IOFilePathreadSymbolicLinkfile=allocaArray04096$\buf->dowithFilePathfile$\s->dolen<-throwErrnoPathIfMinus1"readSymbolicLink"file$c_readlinksbuf4096peekFilePathLen(buf,fromIntegrallen)getExecutablePath=readSymbolicLink$"/proc/self/exe"---------------------------------------------------------------------------------- Windows{-# LINE 176 "System/Environment/ExecutablePath.hsc" #-}

AltStyle によって変換されたページ (->オリジナル) /