diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-11-26 22:23:15 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-11-26 22:23:15 +0000 |
| commit | 72eedf0b240c71b9dbd27d1f95b109b48e3200a2 (patch) | |
| tree | f01295128962cae9fa51e292b22afe066bb7c406 /src/lib/cross.cc | |
| parent | ad0ddd25c94730bed174756a21c83a348c45687e (diff) | |
A whole load of UTF-8/-16 confusion fixes for Windows.
Diffstat (limited to 'src/lib/cross.cc')
| -rw-r--r-- | src/lib/cross.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 41051ee2e..7436dbf26 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -70,6 +70,9 @@ cpu_info () string info; #ifdef DCPOMATIC_LINUX + /* This use of ifstream is ok; the filename can never + be non-Latin + */ ifstream f ("/proc/cpuinfo"); while (f.good ()) { string l; @@ -269,3 +272,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 +} |
