From 7a977c48d71b0b4e9d7130f7d4bc1b35f355f68c Mon Sep 17 00:00:00 2001 From: Nils Husung Date: Fri, 4 Oct 2024 22:11:02 +0200 Subject: [PATCH] Set `tpie::tempname` before calling `tpie_init()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids an additional directory named `TPIE__<…>` at the default tmp path. --- src/adiar/adiar.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/adiar/adiar.cpp b/src/adiar/adiar.cpp index ee73a7946..908302382 100644 --- a/src/adiar/adiar.cpp +++ b/src/adiar/adiar.cpp @@ -70,6 +70,17 @@ namespace adiar } try { + // Set the temporary directory for TPIE before calling + // `tpie::tpie_init()`. This avoids a directory named `TPIE__<...>` + // at the default tmp path. + + // - file names + tpie::tempname::set_default_base_name("ADIAR"); + tpie::tempname::set_default_extension("adiar"); + + // - tmp directory + if (temp_dir != "") { tpie::tempname::set_default_path(temp_dir); } + // Initialise TPIE tpie::tpie_init(_tpie_subsystems); @@ -79,13 +90,6 @@ namespace adiar tpie::add_log_target(&_devnull); #endif - // - file names - tpie::tempname::set_default_base_name("ADIAR"); - tpie::tempname::set_default_extension("adiar"); - - // - tmp directory - if (temp_dir != "") { tpie::tempname::set_default_path(temp_dir); } - // - memory limit and block size tpie::get_memory_manager().set_limit(memory_limit_bytes); internal::set_block_size(internal::recommended_block_size(memory_limit_bytes));