Skip to content

Commit

Permalink
* settings loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan Walter committed Sep 20, 2024
1 parent 2462167 commit aad7f31
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Application/src/tracker/gui/SettingsScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,18 @@ struct SettingsScene::Data {

Print("changed props = ", copy.keys());
auto array = SETTING(source).value<file::PathArray>();
auto front = file::Path(file::find_basename(array));
//auto front = file::Path(file::find_basename(array));

auto output_file = (not front.has_extension() || front.extension() != "pv") ?
auto output_file = settings::find_output_name(before);
if(not output_file.has_extension() || output_file.extension() != "pv")
{
output_file = output_file.add_extension("pv");
}
/*auto output_file = (not front.has_extension() || front.extension() != "pv") ?
file::DataLocation::parse("output", front.add_extension("pv")) :
file::DataLocation::parse("output", front.replace_extension("pv"));
if (output_file.exists()) {
file::DataLocation::parse("output", front.replace_extension("pv"));*/
//if (output_file.exists())
{
SETTING(filename) = file::Path(output_file);
}

Expand Down
6 changes: 6 additions & 0 deletions Application/src/tracker/misc/SettingsInitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,12 @@ void load(file::PathArray source,
} else if(path.is_absolute()) {
combined.map["filename"] = file::Path(path.filename());
set_config_if_different("filename", combined.map);
} else {
#ifndef NDEBUG
Print("Not absolute: ", path);
#endif
combined.map["filename"] = file::Path(path);
set_config_if_different("filename", combined.map);
}
}

Expand Down

0 comments on commit aad7f31

Please sign in to comment.