Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ImGuiFileDialog.cpp #2190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ddddhm1234
Copy link

On Windows systems, when using file_dialog to browse a directory without access permission, such as C:\Users<your user>\SendTo, dpg would hang or crash. This PR fixes this bug.

Operating system:
Windows

Reproduce:
Use file_dialog to browse any directory without access permission on Windows

The origin of this bug:
In ImGuiFileDialog.cpp, ScanDir function

//const auto wpath = IGFD::Utils::WGetString(path.c_str());
const std::filesystem::path fspath(path);
const auto dir_iter = std::filesystem::directory_iterator(fspath); //  <--------  If the current user doesn't have permission to access this directory, an exception will be thrown here without a try block to handle it.

The bug manifests as a freeze or crash of DPG when attempting to access a directory that the current user does not have permission to access on windows using file_dialog. This commit fixes the issue by adding a code snippet that checks the permission to access the target directory before attempting to do so. If the user does not have permission, the program will not access the target directory and stay in the current path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant