Cleanup: simplify mount_point() to just is_mounted().
authorCarl Hetherington <cth@carlh.net>
Sun, 5 Jan 2025 22:09:03 +0000 (23:09 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 6 Jan 2025 23:41:32 +0000 (00:41 +0100)
I think that's all we need.

src/lib/cross_osx.cc

index 8d15e46b58cdc5d730da3dbce0b61ce5fb2370ea..8ae8cf087460dfa628195e05411c704076ef4e70 100644 (file)
@@ -256,19 +256,17 @@ get_model (CFDictionaryRef& description)
 }
 
 
-static optional<boost::filesystem::path>
-mount_point (CFDictionaryRef& description)
+static
+bool
+is_mounted(CFDictionaryRef& description)
 {
        auto volume_path_key = (CFURLRef) CFDictionaryGetValue (description, kDADiskDescriptionVolumePathKey);
        if (!volume_path_key) {
-               return {};
+               return false;
        }
 
        char mount_path_buffer[1024];
-       if (!CFURLGetFileSystemRepresentation(volume_path_key, false, (UInt8 *) mount_path_buffer, sizeof(mount_path_buffer))) {
-               return {};
-       }
-       return boost::filesystem::path(mount_path_buffer);
+       return CFURLGetFileSystemRepresentation(volume_path_key, false, (UInt8 *) mount_path_buffer, sizeof(mount_path_buffer));
 }
 
 
@@ -306,7 +304,7 @@ disk_appeared (DADiskRef disk, void* context)
        this_disk.model = get_model (description);
        LOG_DISK("Vendor/model: %1 %2", this_disk.vendor.get_value_or("[none]"), this_disk.model.get_value_or("[none]"));
 
-       this_disk.mounted = static_cast<bool>(mount_point(description));
+       this_disk.mounted = is_mounted(description);
 
        auto media_size_cstr = CFDictionaryGetValue (description, kDADiskDescriptionMediaSizeKey);
        if (!media_size_cstr) {