Add fopen_boost; remove a couple of defunct usings.
[dcpomatic.git] / src / lib / cross.cc
index 94edb688b5791e9408a0dab369873bfe4d036321..9aa8454c989444dd04532a4b9ef995c36c279b20 100644 (file)
@@ -51,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)
 {
@@ -269,27 +270,18 @@ openssl_path ()
 
 }
 
-list<string>
-network_interfaces ()
+/* 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)
 {
-       list<string> interfaces;
-       
-#ifdef DCPOMATIC_POSIX
-       struct ifaddrs* addresses = 0;
-
-       getifaddrs (&addresses);
-
-       for (struct ifaddrs* i = addresses; i; i = i->ifa_next) {
-               if (i->ifa_addr->sa_family == AF_INET) {
-                       void* p = &((struct sockaddr_in *) i->ifa_addr)->sin_addr;
-                       char b[INET_ADDRSTRLEN];
-                       inet_ntop (AF_INET, p, b, INET_ADDRSTRLEN);
-                       interfaces.push_back (b);
-               }
-       }
-
-       freeifaddrs (addresses);
+#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
-
-       return interfaces;
 }