From a9dd3d27bc52f853309885b1be02d6efd2d2af48 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 25 Nov 2013 00:28:26 +0000 Subject: Add fopen_boost; remove a couple of defunct usings. --- src/lib/config.cc | 1 - src/lib/cross.cc | 16 ++++++++++++++++ src/lib/cross.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/config.cc b/src/lib/config.cc index 4b6455f51..2420ab1b5 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -41,7 +41,6 @@ using std::vector; using std::ifstream; using std::string; -using std::ofstream; using std::list; using std::max; using std::exception; diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 41051ee2e..9aa8454c9 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -269,3 +269,19 @@ openssl_path () #endif } + +/* Apparently there is no way to create an ofstream using a UTF-8 + filename under Windows. We are hence reduced to using fopen + with this wrapper. +*/ +FILE * +fopen_boost (boost::filesystem::path p, string t) +{ +#ifdef DCPOMATIC_WINDOWS + wstring w (t.begin(), t.end()); + /* c_str() here should give a UTF-16 string */ + return _wfopen (p.c_str(), w.c_str ()); +#else + return fopen (p.c_str(), t.c_str ()); +#endif +} diff --git a/src/lib/cross.h b/src/lib/cross.h index 1fe34edbe..931e7d890 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -33,3 +33,4 @@ extern boost::filesystem::path openssl_path (); #ifdef DCPOMATIC_OSX extern boost::filesystem::path app_contents (); #endif +extern FILE * fopen_boost (boost::filesystem::path, std::string); -- cgit v1.2.3