From 490648daaf80d832359e3881acf06c00b55466b7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 5 Jan 2025 23:09:03 +0100 Subject: Cleanup: simplify mount_point() to just is_mounted(). I think that's all we need. --- src/lib/cross_osx.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/cross_osx.cc b/src/lib/cross_osx.cc index 8d15e46b5..8ae8cf087 100644 --- a/src/lib/cross_osx.cc +++ b/src/lib/cross_osx.cc @@ -256,19 +256,17 @@ get_model (CFDictionaryRef& description) } -static optional -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(mount_point(description)); + this_disk.mounted = is_mounted(description); auto media_size_cstr = CFDictionaryGetValue (description, kDADiskDescriptionMediaSizeKey); if (!media_size_cstr) { -- cgit v1.2.3