Fixed warnings with clang.

Implemented Sys::getLogicalDrives for macOS, BSD and iOS.
This commit is contained in:
Martín Lucas Golini
2023-01-14 12:56:47 -03:00
parent c0249bc5ba
commit 851d2de42b
2 changed files with 35 additions and 0 deletions

View File

@@ -40,6 +40,7 @@
#if EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD || \
EE_PLATFORM == EE_PLATFORM_IOS
#include <sys/mount.h>
#include <sys/sysctl.h>
#endif
@@ -951,6 +952,23 @@ std::vector<std::string> Sys::getLogicalDrives() {
}
endmntent( file );
return ret;
#elif EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD || \
EE_PLATFORM == EE_PLATFORM_IOS
std::vector<std::string> ret;
struct statfs* mounts;
int numMounts = getmntinfo( &mounts, MNT_NOWAIT );
if ( numMounts <= 0 )
return ret;
for ( int i = 0; i < numMounts; ++i ) {
auto mnt = mounts[i];
std::string mntType( mnt.f_mntfromname );
if ( mntType == "devfs" || mntType == "autofs" )
continue;
ret.emplace_back( mnt.f_mntonname );
}
return ret;
#else
return {};
#endif