Merge pull request #32904 from bruvzg/mac_vol_list
[macOS] Various volume list fixes
This commit is contained in:
commit
d335cd4877
1 changed files with 11 additions and 4 deletions
|
@ -48,18 +48,25 @@ String DirAccessOSX::fix_unicode_name(const char *p_name) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int DirAccessOSX::get_drive_count() {
|
int DirAccessOSX::get_drive_count() {
|
||||||
NSArray *vols = [[NSWorkspace sharedWorkspace] mountedLocalVolumePaths];
|
NSArray *res_keys = [NSArray arrayWithObjects:NSURLVolumeURLKey, NSURLIsSystemImmutableKey, nil];
|
||||||
|
NSArray *vols = [[NSFileManager defaultManager] mountedVolumeURLsIncludingResourceValuesForKeys:res_keys options:NSVolumeEnumerationSkipHiddenVolumes];
|
||||||
|
|
||||||
return [vols count];
|
return [vols count];
|
||||||
}
|
}
|
||||||
|
|
||||||
String DirAccessOSX::get_drive(int p_drive) {
|
String DirAccessOSX::get_drive(int p_drive) {
|
||||||
NSArray *vols = [[NSWorkspace sharedWorkspace] mountedLocalVolumePaths];
|
NSArray *res_keys = [NSArray arrayWithObjects:NSURLVolumeURLKey, NSURLIsSystemImmutableKey, nil];
|
||||||
|
NSArray *vols = [[NSFileManager defaultManager] mountedVolumeURLsIncludingResourceValuesForKeys:res_keys options:NSVolumeEnumerationSkipHiddenVolumes];
|
||||||
int count = [vols count];
|
int count = [vols count];
|
||||||
|
|
||||||
ERR_FAIL_INDEX_V(p_drive, count, "");
|
ERR_FAIL_INDEX_V(p_drive, count, "");
|
||||||
|
|
||||||
NSString *path = vols[p_drive];
|
String volname;
|
||||||
return String([path UTF8String]);
|
NSString *path = [vols[p_drive] path];
|
||||||
|
|
||||||
|
volname.parse_utf8([path UTF8String]);
|
||||||
|
|
||||||
|
return volname;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //posix_enabled
|
#endif //posix_enabled
|
||||||
|
|
Loading…
Reference in a new issue