Merge branch 'main' into enh-port-edit-gcode-dlg

This commit is contained in:
Ocraftyone 2024-01-05 05:59:43 -05:00 committed by GitHub
commit a8c3377d9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 156 additions and 304 deletions

View file

@ -1539,4 +1539,22 @@ void copy_directory_recursively(const boost::filesystem::path &source, const boo
return;
}
void save_string_file(const boost::filesystem::path& p, const std::string& str)
{
boost::nowide::ofstream file;
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
file.open(p.generic_string(), std::ios_base::binary);
file.write(str.c_str(), str.size());
}
void load_string_file(const boost::filesystem::path& p, std::string& str)
{
boost::nowide::ifstream file;
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
file.open(p.generic_string(), std::ios_base::binary);
std::size_t sz = static_cast<std::size_t>(boost::filesystem::file_size(p));
str.resize(sz, '\0');
file.read(&str[0], sz);
}
}; // namespace Slic3r