From: simonmar Date: Tue, 2 Jul 2002 10:33:23 +0000 (+0000) Subject: [project @ 2002-07-02 10:33:23 by simonmar] X-Git-Tag: nhc98-1-18-release~956 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=be310c3938beda74ac048a0d4a29f5bc86368da1;p=haskell-directory.git [project @ 2002-07-02 10:33:23 by simonmar] Documentation for getProgName. --- diff --git a/System/Environment.hs b/System/Environment.hs index 20b709f..f99df14 100644 --- a/System/Environment.hs +++ b/System/Environment.hs @@ -48,9 +48,16 @@ getArgs = foreign import ccall unsafe "getProgArgv" getProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO () --- Computation `getProgName' returns the name of the program --- as it was invoked. - +{-| +Computation 'getProgName' returns the name of the program as it was +invoked. + +However, this is hard-to-impossible to implement on some non-Unix +OSes, so instead, for maximum portability, we just return the leafname +of the program as invoked. Even then there are some differences +between platforms: on Windows, for example, a program invoked as foo +is probably really @FOO.EXE@, and that is what 'getProgName' will return. +-} getProgName :: IO String getProgName = alloca $ \ p_argc ->