+ // The OS didn't support GetLongPathName, or some other error.
+ // We need to call FindFirstFile on each component in turn.
+
+ WIN32_FIND_DATA findFileData;
+ HANDLE hFind;
+ pathOut = wxEmptyString;
+
+ wxArrayString dirs = GetDirs();
+ dirs.Add(GetFullName());
+
+ size_t count = dirs.GetCount();
+ size_t i;
+ wxString tmpPath;
+
+ for ( i = 0; i < count; i++ )
+ {
+ // We're using pathOut to collect the long-name path,
+ // but using a temporary for appending the last path component which may be short-name
+ tmpPath = pathOut + 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;
+ pathOut = tmpPath;
+ continue;
+ }
+
+ hFind = ::FindFirstFile(tmpPath, &findFileData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ {
+ // Error: return immediately with the original path
+ return path;
+ }
+ else
+ {
+ pathOut += findFileData.cFileName;
+ if ( (i < (count-1)) )
+ pathOut += wxFILE_SEP_PATH;
+
+ ::FindClose(hFind);
+ }
+ }