diff options
author | Greg Steuck <greg@nest.cx> | 2021-10-31 21:51:11 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-25 01:03:54 -0500 |
commit | baa8ffeeb471b72b9bcc3e6a5b4149f488ae01f5 (patch) | |
tree | e215fe9c417c2cc0814909dbd344a069219b7e21 /libraries | |
parent | 6907e9fae4bda5807872073fa98667db327ad0bb (diff) | |
download | haskell-baa8ffeeb471b72b9bcc3e6a5b4149f488ae01f5.tar.gz |
Use getExecutablePath in getBaseDir on OpenBSD
While OpenBSD doesn't have a general mechanism for determining the
path of the executing program image, it is reasonable to rely on
argv[0] which happens as a fallback in getExecutablePath.
With this change on top of T18173 we can get a bit close to fixing #18173.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/ghc-boot/GHC/BaseDir.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/ghc-boot/GHC/BaseDir.hs b/libraries/ghc-boot/GHC/BaseDir.hs index 407f7c0b83..db470425c0 100644 --- a/libraries/ghc-boot/GHC/BaseDir.hs +++ b/libraries/ghc-boot/GHC/BaseDir.hs @@ -23,7 +23,7 @@ import System.FilePath #if defined(mingw32_HOST_OS) import System.Environment (getExecutablePath) -- POSIX -#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) +#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(openbsd_HOST_OS) import System.Environment (getExecutablePath) #endif @@ -52,7 +52,7 @@ getBaseDir = Just . (\p -> p </> "lib") . rootDir <$> getExecutablePath -- that is running this function. rootDir :: FilePath -> FilePath rootDir = takeDirectory . takeDirectory . normalise -#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) +#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(openbsd_HOST_OS) -- on unix, this is a bit more confusing. -- The layout right now is something like -- |