Commit 26ebadc0 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

gui: enable output directory

parent 36d565b6
......@@ -2743,6 +2743,7 @@ editor::show_editor() noexcept
if (!plot) {
plot_output& tf = plot_outs.alloc(names[i].c_str());
tf.ed = this;
plot = &tf;
out.plot_id = plot_outs.get_id(tf);
auto& o = sim.observers.alloc(
......@@ -2763,6 +2764,7 @@ editor::show_editor() noexcept
if (!file) {
file_output& tf = file_outs.alloc(names[i].c_str());
tf.ed = this;
file = &tf;
out.file_id = file_outs.get_id(tf);
auto& o = sim.observers.alloc(
......
......@@ -216,6 +216,8 @@ struct window_logger
static inline window_logger log_w;
struct editor;
struct plot_output
{
plot_output() = default;
......@@ -224,16 +226,7 @@ struct plot_output
: name(name_)
{}
void clear()
{
name.clear();
xs.clear();
ys.clear();
tl = 0.0;
min = -1.f;
max = +1.f;
}
editor* ed = nullptr;
std::vector<float> xs;
std::vector<float> ys;
small_string<24u> name;
......@@ -250,13 +243,7 @@ struct file_output
: name(name_)
{}
void clear()
{
ofs.close();
name.clear();
tl = 0.0;
}
editor* ed = nullptr;
std::ofstream ofs;
small_string<24u> name;
double tl = 0.0;
......@@ -480,7 +467,7 @@ struct application
std::filesystem::path executable_dir;
std::vector<std::string> libraries_dir;
void show(bool *is_open);
void show(bool* is_open);
} settings;
bool show_log = true;
......
......@@ -57,7 +57,11 @@ observation_file_output_initialize(const irt::observer& obs,
auto* output = reinterpret_cast<file_output*>(obs.user_data);
output->tl = t;
std::filesystem::path file(obs.name.begin());
std::filesystem::path file;
if (output->ed && !output->ed->observation_directory.empty())
file = output->ed->observation_directory;
file.append(obs.name.begin());
file.replace_extension(".dat");
output->ofs.open(file);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment