Add fopen_boost; remove a couple of defunct usings.
[dcpomatic.git] / src / lib / cross.cc
index ac94e8015af3554473424d8f672690f5cef8fef0..9aa8454c989444dd04532a4b9ef995c36c279b20 100644 (file)
 #include <sys/sysctl.h>
 #include <mach-o/dyld.h>
 #endif
+#ifdef DCPOMATIC_POSIX
+#include <sys/types.h>
+#include <ifaddrs.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
 #include "exceptions.h"
 
 using std::pair;
@@ -45,6 +51,7 @@ using std::wstring;
 using std::make_pair;
 using boost::shared_ptr;
 
+/** @param s Number of seconds to sleep for */
 void
 dcpomatic_sleep (int s)
 {
@@ -128,11 +135,8 @@ app_contents ()
        
        boost::filesystem::path path (buffer);
        path = boost::filesystem::canonical (path);
-       std::cout << "start " << path << "\n";
        path = path.parent_path ();
-       std::cout << "then " << path << "\n";
        path = path.parent_path ();
-       std::cout << "and then " << path << "\n";
        return path;
 }
 #endif
@@ -265,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
+}