[darcs-users] darcs patch: Obviate DARCS_TESTING_HOME workaround by setting %APPD...
Eric Kow
kowey at darcs.net
Wed May 13 03:08:18 UTC 2009
On Wed, May 13, 2009 at 12:59:52 +1000, Trent W.Buck wrote:
> Trent W. Buck wrote:
> > Is there any reason we can't simply have the test harness set the $HOME
> > *and* %APPDATA% environment variables?
>
> Apparently I haven't submitted this patch to the list yet. Here it is.
> It needs to be tested by a Windows user!
Salvatore, could you have a look?
Thanks,
> Sat May 9 12:34:59 EST 2009 Trent W. Buck <trentbuck at gmail.com>
> * Obviate DARCS_TESTING_HOME workaround by setting %APPDATA% correctly.
Obviate DARCS_TESTING_HOME workaround by setting %APPDATA% correctly.
---------------------------------------------------------------------
> Trent W. Buck <trentbuck at gmail.com>**20090509023459
> Ignore-this: 9a21df6d195dee42d4b0263873f6266f
> ] hunk ./Distribution/ShellHarness.hs 51
> Nothing -> get_darcs_path
> Just x -> return x
> let myenv = [("HOME",cwd)
> - ,("DARCS_TESTING_HOME",cwd)
> + ,("APPDATA",cwd) -- the Windows analogue of $HOME.
> ,("TESTS_WD",cwd)
> ,("EMAIL","tester")
> ,("DARCSEMAIL","tester")
> hunk ./src/Darcs/Repository/Prefs.lhs 43
> import Data.Char ( toUpper )
> import Data.Maybe ( isJust, catMaybes )
> import Data.List ( nub, isPrefixOf, union )
> -import System.Directory ( getAppUserDataDirectory, doesDirectoryExist )
> -import System.Environment( getEnv )
> +import System.Directory ( getAppUserDataDirectory )
> import System.FilePath ( (</>) )
>
> import Darcs.Flags ( DarcsFlag( NoCache, NoSetDefault, DryRun, Ephemeral, RemoteRepo ) )
> hunk ./src/Darcs/Repository/Prefs.lhs 241
> is_darcsdir "../" = True
> is_darcsdir fp = darcsdir `isPrefixOf` fp
>
> +-- | The path of the global preference directory; @~/.darcs@ on Unix,
> +-- and @%APPDATA%/darcs@ on Windows.
> global_prefs_dir :: IO (Maybe FilePath)
> hunk ./src/Darcs/Repository/Prefs.lhs 244
> -global_prefs_dir = do
> - dir <- (</> ".darcs") `fmap` getEnv "DARCS_TESTING_HOME"
> - exists <- doesDirectoryExist dir
> - if exists then return $ Just dir
> - else userDir
> - `catch` \_ -> userDir -- no such environment variable
> - where userDir = (getAppUserDataDirectory "darcs" >>= return.Just)
> +global_prefs_dir = (getAppUserDataDirectory "darcs" >>= return.Just)
> `catchall` (return Nothing)
>
> get_global :: String -> IO [String]
>
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090512/6f4fbd62/attachment.pgp>
More information about the darcs-users
mailing list