diff --git a/v2/build-system.jam b/v2/build-system.jam index 0fe4c0121..e0ad90560 100755 --- a/v2/build-system.jam +++ b/v2/build-system.jam @@ -30,7 +30,7 @@ import version ; # Check if we can load 'test-config.jam'. If we can, load it and # ignore user configs. -local test-config = [ GLOB [ modules.peek : BOOST_BUILD_PATH ] : test-config.jam ] ; +local test-config = [ GLOB [ os.environ BOOST_BUILD_PATH ] : test-config.jam ] ; if $(test-config) { module test-config @@ -46,10 +46,7 @@ if $(test-config) || --ignore-config in [ modules.peek : ARGV ] ignore-config = true ; } -local HOME = [ modules.peek : HOME ] ; -# Bjam breaks vars at spaces -- fix this back. -HOME = $(HOME:J=" ") ; -local user-path = $(HOME) [ modules.peek : BOOST_BUILD_PATH ] ; +local user-path = [ os.home-directories ] [ os.environ BOOST_BUILD_PATH ] ; # Load site-config. module site-config diff --git a/v2/doc/src/reference.xml b/v2/doc/src/reference.xml index 02a62fc6c..06b3ba7c7 100644 --- a/v2/doc/src/reference.xml +++ b/v2/doc/src/reference.xml @@ -85,11 +85,13 @@ boost-build build-system ; %SystemRoot% + %HOMEDRIVE%%HOMEPATH% %HOME% %BOOST_BUILD_PATH% + %HOMEDRIVE%%HOMEPATH% %HOME% %BOOST_BUILD_PATH% diff --git a/v2/util/os.jam b/v2/util/os.jam index 59ac36b4e..c486565e7 100644 --- a/v2/util/os.jam +++ b/v2/util/os.jam @@ -4,6 +4,14 @@ # warranty, and with no claim as to its suitability for any purpose. import modules ; + +# Return the value(s) of the given environment variable(s) at the time +# bjam was invoked. +rule environ ( variable-names + ) +{ + return [ modules.peek .ENVIRON : $(variable-names) ] ; +} + .name = [ modules.peek : OS ] ; .platform = [ modules.peek : OSPLAT ] ; .version = [ modules.peek : OSVER ] ; @@ -50,6 +58,22 @@ EXPORT $(__name__) : $(.constants) ; .expand-variable-prefix = $ ; .expand-variable-suffix = "" ; +if $(.name) = NT +{ + local home = [ environ HOMEDRIVE HOMEPATH HOME ] ; + .home-directories = $(home[1])$(home[2]) $(home[3]) ; +} +else +{ + .home-directories = [ environ HOME ] ; +} + +# Can't use 'constant' mechanism because it only returns 1-element +# values. +rule home-directories ( ) +{ + return $(.home-directories) ; +} # Return the string needed to represent the expansion of the named # shell variable. rule expand-variable ( variable )