Revert "More fixes for non-ASCII paths on Windows"

This reverts commit e79eac2671fca060a04d8183e97b655523eafdfb.
This commit is contained in:
Alessandro Ranellucci 2016-08-28 11:23:06 +02:00
parent 1532f54350
commit 66e48e9d22
3 changed files with 7 additions and 23 deletions

View File

@ -20,4 +20,3 @@ addons:
- libboost-thread1.55-dev
- libboost-system1.55-dev
- libboost-filesystem1.55-dev
- libboost-locale1.55-dev

View File

@ -47,7 +47,7 @@ if (defined $ENV{BOOST_DIR}) {
# In order to generate the -l switches we need to know how Boost libraries are named
my $have_boost = 0;
my @boost_libraries = qw(system thread filesystem locale); # we need these
my @boost_libraries = qw(system thread filesystem); # we need these
# check without explicit lib path (works on Linux)
$have_boost = 1

View File

@ -4,14 +4,10 @@
#include <ctime>
#include <fstream>
#include <iostream>
#include <locale>
#include <exception> // std::runtime_error
#include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/foreach.hpp>
#include <boost/locale.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree.hpp>
@ -218,32 +214,21 @@ ConfigBase::load(const std::string &file)
void
ConfigBase::save(const std::string &file) const
{
// Get the default locale
std::locale loc = boost::locale::generator().generate("");
using namespace std;
ofstream c;
c.open(file.c_str(), ios::out | ios::trunc);
// Set the global locale to loc
std::locale::global(loc);
// Make boost.filesystem use it by default
boost::filesystem::path::imbue(std::locale());
// Create the path (file is assumed to be be utf-8)
boost::filesystem::path path(file);
boost::filesystem::ofstream c;
c.open(path, std::ios::out | std::ios::trunc);
{
time_t now;
time(&now);
char buf[sizeof "0000-00-00 00:00:00"];
strftime(buf, sizeof buf, "%F %T", gmtime(&now));
c << "# generated by Slic3r " << SLIC3R_VERSION << " on " << buf << std::endl;
c << "# generated by Slic3r " << SLIC3R_VERSION << " on " << buf << endl;
}
t_config_option_keys my_keys = this->keys();
for (t_config_option_keys::const_iterator opt_key = my_keys.begin(); opt_key != my_keys.end(); ++opt_key)
c << *opt_key << " = " << this->serialize(*opt_key) << std::endl;
c << *opt_key << " = " << this->serialize(*opt_key) << endl;
c.close();
}