git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9582
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/tokenzr.h"
#include "wx/config.h" // for wxExpandEnvVars
#include "wx/utils.h"
#include "wx/tokenzr.h"
#include "wx/config.h" // for wxExpandEnvVars
#include "wx/utils.h"
+
+#if wxUSE_DYNLIB_CLASS
// For GetShort/LongPathName
#ifdef __WIN32__
// For GetShort/LongPathName
#ifdef __WIN32__
wxString pathOut;
bool success = FALSE;
wxString pathOut;
bool success = FALSE;
typedef DWORD (*GET_LONG_PATH_NAME)(const wxChar *, wxChar *, DWORD);
static bool s_triedToLoad = FALSE;
typedef DWORD (*GET_LONG_PATH_NAME)(const wxChar *, wxChar *, DWORD);
static bool s_triedToLoad = FALSE;
s_triedToLoad = TRUE;
wxDllType dllKernel = wxDllLoader::LoadLibrary(_T("kernel32"));
s_triedToLoad = TRUE;
wxDllType dllKernel = wxDllLoader::LoadLibrary(_T("kernel32"));
+ if ( 0 ) // dllKernel )
{
// may succeed or fail depending on the Windows version
{
// may succeed or fail depending on the Windows version
- s_pfnGetLongPathName = (GET_LONG_PATH_NAME) wxDllLoader::GetSymbol(dllKernel, _T("GetLongPathName"));
+#ifdef _UNICODE
+ s_pfnGetLongPathName = (GET_LONG_PATH_NAME) wxDllLoader::GetSymbol(dllKernel, _T("GetLongPathNameW"));
+#else
+ s_pfnGetLongPathName = (GET_LONG_PATH_NAME) wxDllLoader::GetSymbol(dllKernel, _T("GetLongPathNameA"));
+#endif
wxDllLoader::UnloadLibrary(dllKernel);
wxDllLoader::UnloadLibrary(dllKernel);
}
if (success)
return pathOut;
}
if (success)
return pathOut;
+#endif
+ // wxUSE_DYNLIB_CLASS
size_t count = m_dirs.GetCount();
size_t i;
wxString tmpPath;
size_t count = m_dirs.GetCount();
size_t i;
wxString tmpPath;
for ( i = 0; i < count; i++ )
{
// We're using pathOut to collect the long-name path,
for ( i = 0; i < count; i++ )
{
// We're using pathOut to collect the long-name path,
tmpPath = pathOut + m_dirs[i];
if (tmpPath.Last() == wxT(':'))
tmpPath = pathOut + m_dirs[i];
if (tmpPath.Last() == wxT(':'))
+ {
+ // Can't pass a drive and root dir to FindFirstFile,
+ // so continue to next dir
tmpPath += wxFILE_SEP_PATH;
tmpPath += wxFILE_SEP_PATH;
+ pathOut = tmpPath;
+ continue;
+ }
hFind = ::FindFirstFile(tmpPath, &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
hFind = ::FindFirstFile(tmpPath, &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
else
{
pathOut += findFileData.cFileName;
else
{
pathOut += findFileData.cFileName;
pathOut += wxFILE_SEP_PATH;
::FindClose(hFind);
pathOut += wxFILE_SEP_PATH;
::FindClose(hFind);