From ab47dea8053bb1087008dbeec1919a6c5f68863a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 27 Mar 2015 12:55:18 -0400 Subject: 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. --- Annex/Path.hs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'Annex/Path.hs') 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 -- cgit v1.2.3