mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
imgui: fix crash when launching from UNC path (network shares) (#836)
## Link to GitHub Issue or related Pull Request, if one exists n/a ## Description of change ImGui filebrowser extension crashes due to MinGW quirk about UNC path handling. ## Testing
This commit is contained in:
+9
-1
@@ -878,7 +878,15 @@ inline void ImGui::FileBrowser::UpdateFileRecords()
|
|||||||
|
|
||||||
inline void ImGui::FileBrowser::SetPwdUncatched(const std::filesystem::path &pwd)
|
inline void ImGui::FileBrowser::SetPwdUncatched(const std::filesystem::path &pwd)
|
||||||
{
|
{
|
||||||
pwd_ = absolute(pwd);
|
// spice2x
|
||||||
|
// avoid MinGW std::filesystem::absolute() duplicating UNC server/share
|
||||||
|
// prefixes, which makes directory_iterator() throw during startup
|
||||||
|
// spice2x
|
||||||
|
const auto &nativePwd = pwd.native();
|
||||||
|
const bool hasUncPrefix = nativePwd.size() >= 2 &&
|
||||||
|
(nativePwd[0] == '\\' || nativePwd[0] == '/') &&
|
||||||
|
(nativePwd[1] == '\\' || nativePwd[1] == '/');
|
||||||
|
pwd_ = hasUncPrefix ? pwd : absolute(pwd);
|
||||||
UpdateFileRecords();
|
UpdateFileRecords();
|
||||||
selectedFilenames_.clear();
|
selectedFilenames_.clear();
|
||||||
(*inputNameBuf_)[0] = '\0';
|
(*inputNameBuf_)[0] = '\0';
|
||||||
|
|||||||
Reference in New Issue
Block a user