Skip to content

Commit cb94d06

Browse files
committed
[FIX] : fix an issue with GetFullPathNameW where if we call it with "C:" the result is the current dir, so the separator is concatened, then the result for "C:\\" is "C:\\".
1 parent 1a8f0e2 commit cb94d06

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

ImGuiFileDialog.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,6 @@ bool IGFD::FileManager::GetDrives() {
20012001
info->fileNameExt_optimized = Utils::LowerCaseString(drive.first);
20022002
info->deviceInfos = drive.second;
20032003
info->fileType.SetContent(FileType::ContentType::Directory);
2004-
20052004
if (!info->fileNameExt.empty()) {
20062005
m_FileList.push_back(info);
20072006
}
@@ -2980,7 +2979,7 @@ void IGFD::PlacesFeature::m_InitPlaces(FileDialogInternal& vFileDialogInternal)
29802979
IGFD::FileStyle style;
29812980
style.icon = PLACE_DEVICES_ICON;
29822981
for (const auto& device : devices) {
2983-
devices_ptr->AddPlace(device.first + " " + device.second, device.first, false, style);
2982+
devices_ptr->AddPlace(device.first + " " + device.second, device.first + IGFD::Utils::GetPathSeparator(), false, style);
29842983
}
29852984
devices_ptr = nullptr;
29862985
}
@@ -3040,21 +3039,16 @@ bool IGFD::PlacesFeature::m_DrawPlacesPane(FileDialogInternal& vFileDialogIntern
30403039
if (i < 0) continue;
30413040
const PlaceStruct& place = group_ptr->places[(size_t)i];
30423041
ImGui::PushID(i);
3043-
30443042
std::string place_name = place.name;
30453043
if (!place.style.icon.empty()) {
30463044
place_name = place.style.icon + " " + place_name;
30473045
}
3048-
if (ImGui::Selectable(place_name.c_str(), group_ptr->selectedPlaceForEdition == i,
3049-
ImGuiSelectableFlags_AllowDoubleClick) ||
3050-
(group_ptr->selectedPlaceForEdition == -1 && place.path == vFileDialogInternal.fileManager.GetCurrentPath())) // select if path is current
3051-
{
3046+
if (ImGui::Selectable(place_name.c_str(), group_ptr->selectedPlaceForEdition == i, ImGuiSelectableFlags_AllowDoubleClick) ||
3047+
(group_ptr->selectedPlaceForEdition == -1 && place.path == vFileDialogInternal.fileManager.GetCurrentPath())) { // select if path is current
30523048
group_ptr->selectedPlaceForEdition = i;
30533049
IGFD::Utils::ResetBuffer(group_ptr->editBuffer);
30543050
IGFD::Utils::AppendToBuffer(group_ptr->editBuffer, MAX_FILE_DIALOG_NAME_BUFFER, place.name);
3055-
3056-
if (ImGui::IsMouseDoubleClicked(0)) // apply path
3057-
{
3051+
if (ImGui::IsMouseDoubleClicked(0)) { // apply path
30583052
vFileDialogInternal.fileManager.SetCurrentPath(place.path);
30593053
vFileDialogInternal.fileManager.OpenCurrentPath(vFileDialogInternal);
30603054
res = true;

0 commit comments

Comments
 (0)