Opening is working.

This commit is contained in:
Pcornat 2022-01-20 23:18:34 +01:00
parent 2023360149
commit 061883ced0
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0
1 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,14 @@ void Controller::control_menu() const noexcept {
if (ifd::FileDialog::Instance().HasResult()) {
fs::path str = ifd::FileDialog::Instance().GetResult();
SPDLOG_DEBUG("path opening: {}", str.string());
const auto filename = str.filename();
const auto save_path = str.remove_filename();
menu_data.set_filename(*this, filename);
menu_data.set_save_path(*this, save_path);
std::ifstream file{ save_path / filename };
json j = json::parse(file);
file.close();
sheet = j.at("character_sheet").get<character::CharacterSheet>();
}
ifd::FileDialog::Instance().Close();
}