summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-03-27 12:55:18 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-03-27 12:55:18 -0400
commitab47dea8053bb1087008dbeec1919a6c5f68863a (patch)
tree89eb2fdb0478047e5a42ffc0695f934b2cb83d3e /Annex
parent9bfb1b905de738984d4686b43a3d094bfba12805 (diff)
Fix bug introduced in the last release that broke git-annex sync when git-annex was installed from the standalone tarball.
This was introduced by commit 849a4b1a0d71071a602f552125fd7e25689662db However, the same problem could affect other calls to programPath, specifically some on the assistant. So, I fixed it at a deeper level.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Path.hs25
1 files changed, 17 insertions, 8 deletions
diff --git a/Annex/Path.hs b/Annex/Path.hs
index ac4e77645..8209e5ba0 100644
--- a/Annex/Path.hs
+++ b/Annex/Path.hs
@@ -11,7 +11,9 @@ module Annex.Path where
import Common
import Config.Files
-import System.Environment
+import Utility.Env
+
+import System.Environment (getExecutablePath)
{- A fully qualified path to the currently running git-annex program.
-
@@ -19,15 +21,22 @@ import System.Environment
- well, it returns the complete path to the program. But, on other OSs,
- it might return just the basename. Fall back to reading the programFile,
- or searching for the command name in PATH.
+ -
+ - The standalone build runs git-annex via ld.so, and defeats
+ - getExecutablePath. It sets GIT_ANNEX_PROGRAMPATH to the correct path
+ - to the wrapper script to use.
-}
programPath :: IO FilePath
-programPath = do
+programPath = go =<< getEnv "GIT_ANNEX_PROGRAMPATH"
+ where
+ go (Just p) = return p
+ go Nothing = do
#if MIN_VERSION_base(4,6,0)
- exe <- getExecutablePath
- p <- if isAbsolute exe
- then return exe
- else readProgramFile
+ exe <- getExecutablePath
+ p <- if isAbsolute exe
+ then return exe
+ else readProgramFile
#else
- p <- readProgramFile
+ p <- readProgramFile
#endif
- maybe cannotFindProgram return =<< searchPath p
+ maybe cannotFindProgram return =<< searchPath p