bool File::isOnHardDisk() const
Returns true if this file is on a hard disk.
This will fail if it's a network drive, but will still be true for removable hard-disks.
If I pass it a path on a mounted network drive, it’s still returning true.
bool File::isOnHardDisk() const
Returns true if this file is on a hard disk.
This will fail if it's a network drive, but will still be true for removable hard-disks.
If I pass it a path on a mounted network drive, it’s still returning true.
But at the other host it probably is on a hard disk
True, but the comment on the function says:
This will fail if it’s a network drive
But my real problem is, how do I get a list of hard drives on macOS?
File::findFileSystemRoots
doesn’t work, it just gives me /
. Iterating over the contents of /Volumes
gives me network drives as well as hard drives. I can’t figure out a way to discard the network drives.
Best solution I’ve come up with so far is to parse the output of df -Hl
and discard the swap file and any time machine mounted drives.