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 committed Oct 4, 2024
1 parent 6097fd4 commit 8b71833
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/adiar/adiar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,9 @@ namespace adiar
}

try {
// Initialise TPIE
tpie::tpie_init(_tpie_subsystems);

#ifdef NDEBUG
// - add 'dev/null' output for TPIE logging in Production. Otherwise, TPIE will print
// everything to 'std::cerr'.
tpie::add_log_target(&_devnull);
#endif
// 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");
Expand All @@ -86,6 +81,15 @@ namespace adiar
// - tmp directory
if (temp_dir != "") { tpie::tempname::set_default_path(temp_dir); }

// Initialise TPIE
tpie::tpie_init(tpie::ALL);

#ifdef NDEBUG
// - add 'dev/null' output for TPIE logging in Production. Otherwise, TPIE will print
// everything to 'std::cerr'.
tpie::add_log_target(&_devnull);
#endif

// - 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 8b71833

Please sign in to comment.