From 38a1259813d122fa6c7c2da17e4bd8e4221f4389 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 25 Nov 2013 14:29:14 -0400 Subject: [PATCH] improve upgrade paths for OSX --- Assistant/Upgrade.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Assistant/Upgrade.hs b/Assistant/Upgrade.hs index dbc6e521cd..694241f83f 100644 --- a/Assistant/Upgrade.hs +++ b/Assistant/Upgrade.hs @@ -162,7 +162,9 @@ upgradeToDistribution newdir cleanup distributionfile = do ] void $ boolSystem "cp" [ Param "-R" - , File $ tmpdir installBase + -- Trailing slash to copy the directory + -- contents. + , File $ tmpdir installBase ++ "/" , File $ newdir ] sanitycheck newdir @@ -222,10 +224,9 @@ oldVersionLocation = do pdir <- parentDir <$> readProgramFile let dirs = splitDirectories pdir {- It will probably be deep inside a git-annex.app directory. -} - let p = takeWhile (/= "git-annex.app") dirs - let olddir = if p == dirs - then pdir - else joinPath (p ++ ["git-annex.app"]) + let olddir = case findIndex ("git-annex.app" `isPrefixOf`) dirs of + Nothing -> pdir + Just i -> joinPath (take (i + 1) dirs) #else olddir <- parentDir <$> readProgramFile #endif