X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FEnvironment.hs;h=f99df14bebee4327e407374d4730eef4cccbe20a;hb=be310c3938beda74ac048a0d4a29f5bc86368da1;hp=20b709f550813a3fc6b09301047f3a27317b0646;hpb=7362fdb061655b3b202e65ae1abe67adc959ddae;p=ghc-base.git 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 ->