mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-05 17:17:42 +00:00
Add cereal serialize() to VendorProfile, PrinterModel, Preset, and Semver
This commit is contained in:
@@ -150,6 +150,17 @@ Semver get_version_from_json(std::string file_path)
|
||||
}
|
||||
}
|
||||
|
||||
std::string get_vendor_cache_key(const std::string& json_path)
|
||||
{
|
||||
const Semver ver = get_version_from_json(json_path);
|
||||
if (ver.valid())
|
||||
return ver.to_string();
|
||||
// No version field — use mtime as change fingerprint so edits invalidate the cache.
|
||||
boost::system::error_code ec;
|
||||
const std::time_t mtime = boost::filesystem::last_write_time(json_path, ec);
|
||||
return ec ? std::string{} : ("mtime:" + std::to_string(mtime));
|
||||
}
|
||||
|
||||
//BBS: add a function to load the key-values from xxx.json
|
||||
int get_values_from_json(std::string file_path, std::vector<std::string>& keys, std::map<std::string, std::string>& key_values)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user