aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-02-12 19:43:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-12 19:43:59 +0300
commit7d0b6a067682f4e25343b95b28962b5d1828b8ba (patch)
treeb5202716487351a9b696a9e24ea511e7773976de
parentff06bfac111fe46f0b4453b19a7cfe2589644b87 (diff)
Fix init_tmp() not to fail if configuration directory is not a bpkg one
-rw-r--r--bpkg/utility.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx
index 75ba102..26716e8 100644
--- a/bpkg/utility.cxx
+++ b/bpkg/utility.cxx
@@ -47,10 +47,12 @@ namespace bpkg
init_tmp (const dir_path& cfg)
{
// Whether the configuration is required or optional depends on the
- // command so if the configuration directory does not exist, we simply
- // create tmp in a system one and let the command complain if necessary.
+ // command so if the configuration directory does not exist or it is not a
+ // bpkg configuration directory, we simply create tmp in a system one and
+ // let the command complain if necessary.
//
- dir_path d (cfg.empty () || !exists (cfg, true /* ignore_error */)
+ dir_path d (cfg.empty () ||
+ !exists (cfg / bpkg_dir, true /* ignore_error */)
? dir_path::temp_path ("bpkg")
: cfg / bpkg_dir / dir_path ("tmp"));