summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-01-05 23:09:03 +0100
committerCarl Hetherington <cth@carlh.net>2025-01-07 00:41:32 +0100
commit490648daaf80d832359e3881acf06c00b55466b7 (patch)
tree38e1bd95b119d4846609f849c7bee7cdf2f81f4a
parente6119065337a8341955a38239d16267dc75c46c4 (diff)
Cleanup: simplify mount_point() to just is_mounted().
I think that's all we need.
-rw-r--r--src/lib/cross_osx.cc14
1 files 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<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) {