Fixed some encoding issues

This commit is contained in:
Lukas Matena 2024-09-12 10:59:01 +02:00
parent 6ac8c0d00c
commit 171508fc40
6 changed files with 10 additions and 14 deletions

View File

@ -1161,7 +1161,7 @@ std::string log_memory_info(bool ignore_loglevel)
out += "N/A";
#else // i.e. __linux__
size_t tSize = 0, resident = 0, share = 0;
std::ifstream buffer("/proc/self/statm");
boost::nowide::ifstream buffer("/proc/self/statm");
if (buffer && (buffer >> tSize >> resident >> share)) {
size_t page_size = (size_t)sysconf(_SC_PAGE_SIZE); // in case x86-64 is configured to use 2MB pages
size_t rss = resident * page_size;

View File

@ -208,7 +208,7 @@ bool copy_icon(const std::string& icon_path, const std::string& dest_path)
bool create_desktop_file(const std::string& path, const std::string& data)
{
BOOST_LOG_TRIVIAL(debug) <<".desktop to "<< path;
std::ofstream output(path);
boost::nowide::ofstream output(path);
output << data;
struct stat buffer;
if (stat(path.c_str(), &buffer) == 0)

View File

@ -908,9 +908,9 @@ bool GUI_App::init_opengl()
}
// gets path to PrusaSlicer.ini, returns semver from first line comment
static boost::optional<Semver> parse_semver_from_ini(std::string path)
static boost::optional<Semver> parse_semver_from_ini(const std::string& path)
{
std::ifstream stream(path);
boost::nowide::ifstream stream(path);
std::stringstream buffer;
buffer << stream.rdbuf();
std::string body = buffer.str();

View File

@ -1594,18 +1594,14 @@ void GLGizmoSVG::draw_filename(){
wxFileDialog dlg(parent, dlg_title, last_used_directory, dlg_file, wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() == wxID_OK ){
last_used_directory = dlg.GetDirectory();
wxString out_path = dlg.GetPath();
//Slic3r::save(*m_volume_shape.svg_file.image, out_path.ToUTF8().data());
// Be carefull out_path_str is not UTF8 on purpose - storing into not ut6 filepath
std::string out_path_str(out_path.c_str());
std::ofstream stream(out_path_str);
std::string out_path_str(into_u8(dlg.GetPath()));
boost::nowide::ofstream stream(out_path_str);
if (stream.is_open()){
stream << *svg.file_data;
// change source file
m_filename_preview.clear();
m_volume_shape.svg_file->path = out_path.ToUTF8().data();
m_volume_shape.svg_file->path = out_path_str;
m_volume_shape.svg_file->path_in_3mf.clear(); // possible change name
m_volume->emboss_shape->svg_file = m_volume_shape.svg_file; // copy - write changes into volume
} else {

View File

@ -514,7 +514,7 @@ void PresetArchiveDatabase::load_app_manifest_json()
if (!fs::exists(path, ec) || ec) {
copy_initial_manifest();
}
std::ifstream file(path.string());
boost::nowide::ifstream file(path.string());
std::string data;
if (file.is_open()) {
std::string line;
@ -681,7 +681,7 @@ void PresetArchiveDatabase::save_app_manifest_json() const
data += "]";
std::string path = get_stored_manifest_path().string();
std::ofstream file(path);
boost::nowide::ofstream file(path);
if (file.is_open()) {
file << data;
file.close();

View File

@ -301,7 +301,7 @@ void Http::priv::form_add_file(const char *name, const fs::path &path, const cha
//FIXME may throw! Is the caller aware of it?
void Http::priv::set_post_body(const fs::path &path)
{
std::ifstream file(path.string());
boost::nowide::ifstream file(path.string());
std::string file_content { std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>() };
postfields = std::move(file_content);
}