Support wchar_t* strings on Win32 to open std::ofstreams

This commit is contained in:
David Capello 2015-04-07 01:28:11 -03:00
parent 0bde95650d
commit 613e710ccf
3 changed files with 15 additions and 1 deletions

View File

@ -53,7 +53,11 @@ void Session::create(base::pid pid)
{
m_pid = pid;
#ifdef _WIN32
std::ofstream of(base::from_utf8(pidFilename()));
#else
std::ofstream of(pidFilename());
#endif
of << m_pid;
}

View File

@ -20,6 +20,7 @@
#include "base/convert_to.h"
#include "base/path.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "base/unique_ptr.h"
#include "doc/algorithm/shrink_bounds.h"
#include "doc/cel.h"
@ -264,7 +265,11 @@ Document* DocumentExporter::exportSheet()
if (m_dataFilename.empty())
osbuf = std::cout.rdbuf();
else {
#ifdef _WIN32
fos.open(base::from_utf8(m_dataFilename).c_str(), std::ios::out);
#else
fos.open(m_dataFilename.c_str(), std::ios::out);
#endif
osbuf = fos.rdbuf();
}
std::ostream os(osbuf);

View File

@ -12,10 +12,11 @@
#include "app/res/http_loader.h"
#include "base/bind.h"
#include "base/replace_string.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/replace_string.h"
#include "base/scoped_value.h"
#include "base/string.h"
#include "net/http_request.h"
#include "net/http_response.h"
@ -58,7 +59,11 @@ void HttpLoader::threadHttpRequest()
base::replace_string(fn, "&", "-");
fn = base::join_path(dir, fn);
#ifdef _WIN32
std::ofstream output(base::from_utf8(fn).c_str());
#else
std::ofstream output(fn.c_str());
#endif
net::HttpRequest http(m_url);
net::HttpResponse response(&output);
http.send(response);