mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 01:01:15 -06:00
* A *lot* of import fixes for flatpak Aside, thank you @hadess for the majority of these fixes. You are the base point for a lot of issues fixed during the creation of this flatpak. * Use slic3r::load_string_file Boost 1.84 removed `boost::fs::load_string_file` so use the func located in Utils.hpp
27 lines
849 B
C++
27 lines
849 B
C++
#include "FileHelp.hpp"
|
|
#include <boost/filesystem.hpp>
|
|
#include <boost/log/trivial.hpp>
|
|
#include <regex>
|
|
namespace Slic3r {
|
|
namespace Utils {
|
|
|
|
bool is_file_too_large(std::string file_path, bool &try_ok)
|
|
{
|
|
try {
|
|
uintmax_t fileSizeBytes = boost::filesystem::file_size(file_path);
|
|
double fileSizeMB = static_cast<double>(fileSizeBytes) / 1024 / 1024;
|
|
try_ok = true;
|
|
if (fileSizeMB > STL_SVG_MAX_FILE_SIZE_MB) { return true; }
|
|
} catch (boost::filesystem::filesystem_error &e) {
|
|
try_ok = false;
|
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " error message: " << e.what();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void slash_to_back_slash(std::string &file_path) {
|
|
std::regex regex("\\\\");
|
|
file_path = std::regex_replace(file_path, regex, "/");
|
|
}
|
|
|
|
}} // namespace Slic3r::Utils
|