Files
BohdanBuinich 9107f80434 Retrieve free disk space macOS, Linux, and Windows. (#119)
* Retrieve free disk space macOS, Linux, and Windows.

This commit (and PR) introduces a **new function** to retrieve free disk space in a unified manner across macOS, Linux, and Windows.
It refactors existing logic to ensure consistency, readability, and maintainability.

- **Common**
  - Introduced a new function/method to retrieve free disk size in a consistent manner across platforms.

- **macOS**
  - Implemented a mount-based approach using `statfs()` to fetch free space.
  - Physical or container disks (like `disk0` or APFS containers) may return **-1** if they have **no** mounted filesystem.
    For example, APFS containers are not directly mounted but contain APFS volumes; only the volumes have valid mount points.

- **Linux**
  - Leveraged existing logic with `statvfs()` for retrieving free space.
  - Minor refactoring.

- **Windows**
  - Maintained the `GetLogicalDriveStrings()` + `GetDiskFreeSpaceEx()` approach for free size.

- Returning **-1** indicates an **unreachable** or **unmounted** filesystem. This behavior is most commonly seen on **macOS** with APFS containers or physical devices that are **not** directly mounted.
- In all scenarios, if the disk cannot be located or if the OS functions fail, **-1** is returned to signify no valid free-space calculation.

* feat: support getting volume paths (#2)

* fix: use the latest supported standard instead of forcing C++-11

* feat: support getting volume paths

* docs: update readme to add the volumes support

* Update CMakeLists.txt

reverted changes

* Update CMakeLists.txt

---------

Co-authored-by: Amin Ya <aminyahyaabadi74@gmail.com>
Co-authored-by: Leon Freist <freist.leon@gmail.com>
2025-04-23 21:11:35 +02:00
..
2024-07-25 15:39:32 +02:00
2024-08-02 22:20:04 +02:00
2024-08-02 22:20:04 +02:00
2024-08-02 22:20:04 +02:00
2024-08-02 22:20:04 +02:00
2024-08-02 22:20:04 +02:00
2024-07-24 15:48:06 +02:00
2024-08-02 22:20:04 +02:00