Godot Engine – Multi-platform 2D and 3D game engine
avoid running 'GetVolumeInfotmationW' on network drives efficiently
Duke Manchester9338b10dd3e6
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cppindex d4dab4e533b..292b6efb2fa 100644--- a/drivers/windows/dir_access_windows.cpp+++ b/drivers/windows/dir_access_windows.cpp@@ -143,8 +143,14 @@ void DirAccessWindows::_update_drives() {String drive = String::chr('A' + i) + ':';String path = drive + '\\';String label;+ Char16String cs = path.utf16();+ UINT type = GetDriveTypeW((LPCWSTR)cs.get_data());+ if (type == DRIVE_REMOTE) {+ drives.push_back(DriveInfo{ drive, "<network>" });+ continue;+ }char16_t wlabel[4096];- if (GetVolumeInformationW((LPCWSTR)(path).utf16().get_data(), (LPWSTR)wlabel, 4096, nullptr, nullptr, nullptr, nullptr, 0)) {+ if (GetVolumeInformationW((LPCWSTR)cs.get_data(), (LPWSTR)wlabel, 4096, nullptr, nullptr, nullptr, nullptr, 0)) {label = String::utf16(wlabel);}drives.push_back(DriveInfo{ drive, label });