mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 22:55:56 +08:00
Fixed some encoding issues
This commit is contained in:
parent
6ac8c0d00c
commit
171508fc40
@ -1161,7 +1161,7 @@ std::string log_memory_info(bool ignore_loglevel)
|
|||||||
out += "N/A";
|
out += "N/A";
|
||||||
#else // i.e. __linux__
|
#else // i.e. __linux__
|
||||||
size_t tSize = 0, resident = 0, share = 0;
|
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)) {
|
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 page_size = (size_t)sysconf(_SC_PAGE_SIZE); // in case x86-64 is configured to use 2MB pages
|
||||||
size_t rss = resident * page_size;
|
size_t rss = resident * page_size;
|
||||||
|
@ -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)
|
bool create_desktop_file(const std::string& path, const std::string& data)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) <<".desktop to "<< path;
|
BOOST_LOG_TRIVIAL(debug) <<".desktop to "<< path;
|
||||||
std::ofstream output(path);
|
boost::nowide::ofstream output(path);
|
||||||
output << data;
|
output << data;
|
||||||
struct stat buffer;
|
struct stat buffer;
|
||||||
if (stat(path.c_str(), &buffer) == 0)
|
if (stat(path.c_str(), &buffer) == 0)
|
||||||
|
@ -908,9 +908,9 @@ bool GUI_App::init_opengl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// gets path to PrusaSlicer.ini, returns semver from first line comment
|
// 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;
|
std::stringstream buffer;
|
||||||
buffer << stream.rdbuf();
|
buffer << stream.rdbuf();
|
||||||
std::string body = buffer.str();
|
std::string body = buffer.str();
|
||||||
|
@ -1594,18 +1594,14 @@ void GLGizmoSVG::draw_filename(){
|
|||||||
wxFileDialog dlg(parent, dlg_title, last_used_directory, dlg_file, wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
wxFileDialog dlg(parent, dlg_title, last_used_directory, dlg_file, wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||||
if (dlg.ShowModal() == wxID_OK ){
|
if (dlg.ShowModal() == wxID_OK ){
|
||||||
last_used_directory = dlg.GetDirectory();
|
last_used_directory = dlg.GetDirectory();
|
||||||
wxString out_path = dlg.GetPath();
|
std::string out_path_str(into_u8(dlg.GetPath()));
|
||||||
//Slic3r::save(*m_volume_shape.svg_file.image, out_path.ToUTF8().data());
|
boost::nowide::ofstream stream(out_path_str);
|
||||||
|
|
||||||
// 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);
|
|
||||||
if (stream.is_open()){
|
if (stream.is_open()){
|
||||||
stream << *svg.file_data;
|
stream << *svg.file_data;
|
||||||
|
|
||||||
// change source file
|
// change source file
|
||||||
m_filename_preview.clear();
|
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_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
|
m_volume->emboss_shape->svg_file = m_volume_shape.svg_file; // copy - write changes into volume
|
||||||
} else {
|
} else {
|
||||||
|
@ -514,7 +514,7 @@ void PresetArchiveDatabase::load_app_manifest_json()
|
|||||||
if (!fs::exists(path, ec) || ec) {
|
if (!fs::exists(path, ec) || ec) {
|
||||||
copy_initial_manifest();
|
copy_initial_manifest();
|
||||||
}
|
}
|
||||||
std::ifstream file(path.string());
|
boost::nowide::ifstream file(path.string());
|
||||||
std::string data;
|
std::string data;
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
std::string line;
|
std::string line;
|
||||||
@ -681,7 +681,7 @@ void PresetArchiveDatabase::save_app_manifest_json() const
|
|||||||
data += "]";
|
data += "]";
|
||||||
|
|
||||||
std::string path = get_stored_manifest_path().string();
|
std::string path = get_stored_manifest_path().string();
|
||||||
std::ofstream file(path);
|
boost::nowide::ofstream file(path);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
file << data;
|
file << data;
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -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?
|
//FIXME may throw! Is the caller aware of it?
|
||||||
void Http::priv::set_post_body(const fs::path &path)
|
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>() };
|
std::string file_content { std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>() };
|
||||||
postfields = std::move(file_content);
|
postfields = std::move(file_content);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user