Require boost 1.61.0 or above on Windows/macOS.
[dcpomatic.git] / src / lib / cross_osx.cc
index 8f057c2bfc5cf38307f721142e860e217bd034f0..fc8ccd4a872dbe2566324d877d053e5beaa80637 100644 (file)
@@ -99,19 +99,7 @@ cpu_info ()
 boost::filesystem::path
 directory_containing_executable ()
 {
-#if BOOST_VERSION >= 106100
        return boost::dll::program_location().parent_path();
-#else
-       uint32_t size = 1024;
-       char buffer[size];
-       if (_NSGetExecutablePath (buffer, &size)) {
-               throw runtime_error ("_NSGetExecutablePath failed");
-       }
-
-       boost::filesystem::path path (buffer);
-       path = boost::filesystem::canonical (path);
-       return path.parent_path ();
-#endif
 }
 
 
@@ -275,7 +263,12 @@ get_vendor (CFDictionaryRef& description)
                return {};
        }
 
-       string s = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+       auto c_str = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+       if (!c_str) {
+               return {};
+       }
+
+       string s (c_str);
        boost::algorithm::trim (s);
        return s;
 }
@@ -288,7 +281,12 @@ get_model (CFDictionaryRef& description)
                return {};
        }
 
-       string s = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+       auto c_str = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+       if (!c_str) {
+               return {};
+       }
+
+       string s (c_str);
        boost::algorithm::trim (s);
        return s;
 }
@@ -415,6 +413,7 @@ disk_appeared (DADiskRef disk, void* context)
 {
        auto bsd_name = DADiskGetBSDName (disk);
        if (!bsd_name) {
+               LOG_DISK_NC("Disk with no BSDName appeared");
                return;
        }
        LOG_DISK("%1 appeared", bsd_name);
@@ -422,6 +421,7 @@ disk_appeared (DADiskRef disk, void* context)
        Disk this_disk;
 
        this_disk.mount_point = string("/dev/") + bsd_name;
+       LOG_DISK("Mount point is %1", this_disk.mount_point);
 
        CFDictionaryRef description = DADiskCopyDescription (disk);