Wildmeshing Toolkit
Loading...
Searching...
No Matches
export_cache.cpp
Go to the documentation of this file.
1#include "export_cache.hpp"
2
5
7
8namespace wmtk::components {
9
10void export_cache(const utils::Paths& paths, const nlohmann::json& j, io::Cache& cache)
11{
12 using namespace internal;
13
14 ExportCacheOptions options = j.get<ExportCacheOptions>();
15
16 std::string export_location =
17 wmtk::utils::resolve_path(options.folder.string(), paths.root_path);
18
19 if (std::filesystem::exists(export_location)) {
20 log_and_throw_error("Cannot export cache, folder {} already exists", export_location);
21 }
22
23 if (!cache.export_cache(export_location)) {
24 log_and_throw_error("Could not export cache from {}", export_location);
25 }
26}
27} // namespace wmtk::components
bool export_cache(const std::filesystem::path &export_location)
Export the cache to the given location.
Definition Cache.cpp:232
void export_cache(const utils::Paths &paths, const nlohmann::json &j, io::Cache &cache)
void log_and_throw_error(const std::string &msg)
Definition Logger.cpp:101