diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 15:27:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 15:44:40 +0200 |
commit | 2a9204cab666d47770bf3809d95a689088019121 (patch) | |
tree | 32730291f7e6de8ef0a227905520dd66fb4ec0f3 /libbuild2/build/script/script.cxx | |
parent | d6581aa9be74e83cc689bfdaae9aaf2e78287975 (diff) |
Various minor fixes and cleanups
Diffstat (limited to 'libbuild2/build/script/script.cxx')
-rw-r--r-- | libbuild2/build/script/script.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libbuild2/build/script/script.cxx b/libbuild2/build/script/script.cxx index e344b59..3485f54 100644 --- a/libbuild2/build/script/script.cxx +++ b/libbuild2/build/script/script.cxx @@ -22,7 +22,7 @@ namespace build2 static const optional<string> wd_name ("current directory"); environment:: - environment (action a, const target_type& t) + environment (action a, const target_type& t, bool temp) : build2::script::environment ( t.ctx, cast<target_triplet> (t.ctx.global_scope["build.host"]), @@ -34,9 +34,7 @@ namespace build2 target (t), vars (context, false /* global */) { - // Set special variables. Note that the $~ variable is set later and - // only if the temporary directory is required for the script - // execution (see create_temp_dir() for details). + // Set special variables. // { // $> @@ -65,6 +63,14 @@ namespace build2 assign (var_pool.insert ("<")) = move (ns); } + + // Set the $~ special variable. + // + if (temp) + { + create_temp_dir (); + assign (var_pool.insert<dir_path> ("~")) = temp_dir.path; + } } void environment:: @@ -118,11 +124,6 @@ namespace build2 << e; } - // Set the $~ special variable. - // - value& v (assign (var_pool.insert<dir_path> ("~"))); - v = td; - if (verb >= 3) text << "mkdir " << td; } |