Be more persistent in getting the media path key.
authorCarl Hetherington <cth@carlh.net>
Thu, 20 Jan 2022 11:04:49 +0000 (12:04 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 20 Jan 2022 11:04:49 +0000 (12:04 +0100)
src/lib/cross_osx.cc

index 2dc9b2702b006044f8d384e450f6877753ccc4c3..7e5fdacdc5f4c233b3848d5d2424e3845c524100 100644 (file)
@@ -320,10 +320,15 @@ analyse_media_path (CFDictionaryRef& description)
                return {};
        }
 
+       char buffer[256];
        auto path_key_cstr = CFStringGetCStringPtr((CFStringRef) str, kCFStringEncodingUTF8);
        if (!path_key_cstr) {
-               LOG_DISK_NC("There is no MediaPathKey (no cstring)");
-               return {};
+               if (CFStringGetCString((CFStringRef) str, buffer, 256, kCFStringEncodingUTF8)) {
+                       path_key_cstr = buffer;
+               } else {
+                       LOG_DISK_NC("There is no MediaPathKey (no cstring)");
+                       return {};
+               }
        }
 
        string path(path_key_cstr);