diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-10-01 21:39:04 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-10-02 21:36:38 +0100 |
commit | 58eaacc9967b7c627a66d49047fb447ac065706e (patch) | |
tree | bf3fa82d6d9a1abb0586c32f09b4680dfdfc8450 /compiler/utils/Util.lhs | |
parent | 483c763341360f810ed2136b95591db1486d0533 (diff) | |
download | haskell-58eaacc9967b7c627a66d49047fb447ac065706e.tar.gz |
Add a flag to tell ghc to use $ORIGIN when linking program dynamically
Diffstat (limited to 'compiler/utils/Util.lhs')
-rw-r--r-- | compiler/utils/Util.lhs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 87171545f8..f9927de2f0 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -87,6 +87,7 @@ module Util ( escapeSpaces, parseSearchPath, Direction(..), reslash, + makeRelativeTo, -- * Utils for defining Data instances abstractConstr, abstractDataType, mkNoRepType, @@ -1006,6 +1007,17 @@ reslash d = f slash = case d of Forwards -> '/' Backwards -> '\\' + +makeRelativeTo :: FilePath -> FilePath -> FilePath +this `makeRelativeTo` that = directory </> thisFilename + where (thisDirectory, thisFilename) = splitFileName this + thatDirectory = dropFileName that + directory = joinPath $ f (splitPath thisDirectory) + (splitPath thatDirectory) + + f (x : xs) (y : ys) + | x == y = f xs ys + f xs ys = replicate (length ys) ".." ++ xs \end{code} %************************************************************************ |