Skip to content

Commit

Permalink
[IMP] : improvment of device view. add the device name displayed only
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Feb 19, 2024
1 parent 98bd919 commit 187966b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions FileSystemBoost.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ class FileSystemBoost : public IGFD::IFileSystem {
}
return res;
}
std::vector<std::string> GetDrivesList() override {
std::vector<std::string> res;

std::vector<std::pair<std::string, std::string>> GetDevicesList() override {
std::vector<std::pair<std::string, std::string>> res;
#ifdef _IGFD_WIN_
const DWORD mydrives = 2048;
char lpBuffer[2048];
Expand All @@ -93,7 +94,18 @@ class FileSystemBoost : public IGFD::IFileSystem {
if (countChars > 0U && countChars < 2049U) {
std::string var = std::string(lpBuffer, (size_t)countChars);
IGFD::Utils::ReplaceString(var, "\\", "");
res = IGFD::Utils::SplitStringToVector(var, '\0', false);
auto arr = IGFD::Utils::SplitStringToVector(var, '\0', false);
wchar_t szVolumeName[2048];
std::pair<std::string, std::string> path_name;
for (auto& a : arr) {
path_name.first = a;
path_name.second.clear();
std::wstring wpath = IGFD::Utils::UTF8Decode(a);
if (GetVolumeInformationW(wpath.c_str(), szVolumeName, 2048, NULL, NULL, NULL, NULL, 0)) {
path_name.second = IGFD::Utils::UTF8Encode(szVolumeName);
}
res.push_back(path_name);
}
}
#endif // _IGFD_WIN_
return res;
Expand Down
2 changes: 1 addition & 1 deletion ImGuiFileDialog

0 comments on commit 187966b

Please sign in to comment.