From 63bd77caf9141e9d5384636d40a3db358b6a7292 Mon Sep 17 00:00:00 2001 From: Stone Li Date: Tue, 30 Aug 2022 18:04:44 +0800 Subject: [PATCH] ENH: save hms file to hms folder Change-Id: I20ff7317c689eefc684c44e6509a45f5911de7fe --- src/slic3r/GUI/HMS.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index 203b2d3217..63ce64cb21 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -83,7 +83,11 @@ int HMSQuery::load_from_local(std::string &version_info) return -1; } std::string filename = get_hms_file(); - std::string dir_str = (boost::filesystem::path(data_dir()) / filename).make_preferred().string(); + auto hms_folder = (boost::filesystem::path(data_dir()) / "hms"); + if (!fs::exists(hms_folder)) + fs::create_directory(hms_folder); + + std::string dir_str = (hms_folder / filename).make_preferred().string(); std::ifstream json_file(encode_path(dir_str.c_str())); try { if (json_file.is_open()) { @@ -111,7 +115,10 @@ int HMSQuery::save_to_local() return -1; } std::string filename = get_hms_file(); - std::string dir_str = (boost::filesystem::path(data_dir()) / filename).make_preferred().string(); + auto hms_folder = (boost::filesystem::path(data_dir()) / "hms"); + if (!fs::exists(hms_folder)) + fs::create_directory(hms_folder); + std::string dir_str = (hms_folder / filename).make_preferred().string(); std::ofstream json_file(encode_path(dir_str.c_str())); if (json_file.is_open()) { json_file << std::setw(4) << m_hms_json << std::endl;