From: Vadim Zeitlin Date: Sat, 17 Nov 2007 15:31:17 +0000 (+0000) Subject: test for remote drive existence using wxDirExists() first if it's mapped locally... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1d243ee08447830d4fa964604c443e0db982768d test for remote drive existence using wxDirExists() first if it's mapped locally, it can be much faster if the drive is unavailable (patch 1831209) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50029 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/volume.cpp b/src/msw/volume.cpp index fb471ddf5f..9c9eecef83 100644 --- a/src/msw/volume.cpp +++ b/src/msw/volume.cpp @@ -264,6 +264,17 @@ static void BuildListFromNN(wxArrayString& list, NETRESOURCE* pResSrc, { wxString filename(pRes->lpRemoteName); + // if the drive is unavailable, FilteredAdd() can hang for + // a long time and, moreover, its failure appears to be not + // cached so this will happen every time we use it, so try + // a much quicker wxDirExists() test (which still hangs but + // for much shorter time) for locally mapped drives first + // to try to avoid this + if ( pRes->lpLocalName && + *pRes->lpLocalName && + !wxDirExists(pRes->lpLocalName) ) + continue; + if (!filename.empty()) { if (filename.Last() != '\\')