MCPcopy Create free account
hub / github.com/aiekick/ImGuiFileDialog / GetDevicesList

Method GetDevicesList

ImGuiFileDialog.cpp:508–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506 }
507
508 std::vector<IGFD::PathDisplayedName> GetDevicesList() override {
509 std::vector<IGFD::PathDisplayedName> res;
510#ifdef _IGFD_WIN_
511 const DWORD mydevices = 2048;
512 char lpBuffer[2048];
513#define mini(a, b) (((a) < (b)) ? (a) : (b))
514 const DWORD countChars = mini(GetLogicalDriveStringsA(mydevices, lpBuffer), 2047);
515#undef mini
516 if (countChars > 0U && countChars < 2049U) {
517 std::string var = std::string(lpBuffer, (size_t)countChars);
518 IGFD::Utils::ReplaceString(var, "\\", "");
519 auto arr = IGFD::Utils::SplitStringToVector(var, '\0', false);
520 wchar_t szVolumeName[2048];
521 IGFD::PathDisplayedName path_name;
522 for (auto& a : arr) {
523 path_name.first = a;
524 path_name.second.clear();
525 std::wstring wpath = IGFD::Utils::UTF8Decode(a);
526 if (GetVolumeInformationW(wpath.c_str(), szVolumeName, 2048, nullptr, nullptr, nullptr, nullptr, 0)) {
527 path_name.second = IGFD::Utils::UTF8Encode(szVolumeName);
528 res.push_back(path_name);
529 }
530 }
531 }
532#endif // _IGFD_WIN_
533 return res;
534 }
535
536 IGFD::Utils::PathStruct ParsePathFileName(const std::string& vPathFileName) override {
537 // https://github.com/aiekick/ImGuiFileDialog/issues/54

Callers 2

GetDevicesMethod · 0.45
m_InitPlacesMethod · 0.45

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected