diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-03 01:24:50 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-07 00:41:32 +0100 |
| commit | e6119065337a8341955a38239d16267dc75c46c4 (patch) | |
| tree | 00c1e068e2cfa63fda75a9781a0d436a83a8aeaa /src/lib/cross.h | |
| parent | a52ccd4da36f22b33934c75c8f1c15daba4b4c00 (diff) | |
Fix failure to unmount drives when one of their partitions is mounted (#2927).
Diffstat (limited to 'src/lib/cross.h')
| -rw-r--r-- | src/lib/cross.h | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/lib/cross.h b/src/lib/cross.h index 551895754..bb1cc91db 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -93,9 +93,19 @@ private: #endif }; + class Drive { public: +#ifdef DCPOMATIC_OSX + Drive(std::string device, bool mounted, uint64_t size, boost::optional<std::string> vendor, boost::optional<std::string> model) + : _device(device) + , _mounted(mounted) + , _size(size) + , _vendor(vendor) + , _model(model) + {} +#else Drive (std::string device, std::vector<boost::filesystem::path> mount_points, uint64_t size, boost::optional<std::string> vendor, boost::optional<std::string> model) : _device(device) , _mount_points(mount_points) @@ -103,6 +113,7 @@ public: , _vendor(vendor) , _model(model) {} +#endif explicit Drive (std::string); @@ -115,7 +126,11 @@ public: } bool mounted () const { +#ifdef DCPOMATIC_OSX + return _mounted; +#else return !_mount_points.empty(); +#endif } std::string log_summary () const; @@ -125,23 +140,28 @@ public: */ bool unmount (); +#ifdef DCPOMATIC_OSX + void set_mounted() { + _mounted = true; + } +#endif + static std::vector<Drive> get (); private: std::string _device; - /** Descriptions of how this drive is mounted. This is interpreted differently - * on different platforms. - * - * On macOS it's a list of device nodes e.g. /dev/disk8, /dev/disk8s2, /dev/disk7s5 or - * filesystem mount points (the contents are not important, just if any exist). - */ +#ifdef DCPOMATIC_OSX + bool _mounted; +#else std::vector<boost::filesystem::path> _mount_points; +#endif /** size in bytes */ uint64_t _size; boost::optional<std::string> _vendor; boost::optional<std::string> _model; }; + void disk_write_finished (); |
