Skip to content

Commit

Permalink
Set tpie::tempname before calling tpie_init()
Browse files Browse the repository at this point in the history
This avoids an additional directory named `TPIE_<date>_<…>` at the
default tmp path.
  • Loading branch information
nhusung authored and SSoelvsten committed Oct 7, 2024
1 parent 6097fd4 commit 6b17038
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/adiar/adiar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ namespace adiar
}

try {
// Set the temporary directory for TPIE before calling
// `tpie::tpie_init()`. This avoids a directory named `TPIE_<date>_<...>`
// 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);

Expand All @@ -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));
Expand Down

0 comments on commit 6b17038

Please sign in to comment.