Now uses GetFileAttributes for wxPathExists and wxFileExists under Windows,
so it copes with network paths. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -272,8 +272,11 @@ wxString wxPathList::FindAbsoluteValidPath (const wxString& file)
|
|||||||
bool
|
bool
|
||||||
wxFileExists (const wxString& filename)
|
wxFileExists (const wxString& filename)
|
||||||
{
|
{
|
||||||
#ifdef __GNUWIN32__ // (fix a B20 bug)
|
#ifdef __WINDOWS__
|
||||||
return GetFileAttributes(filename) != 0xFFFFFFFF;
|
// GetFileAttributes can copy with network paths
|
||||||
|
DWORD ret = GetFileAttributes(filename);
|
||||||
|
DWORD isDir = (ret & FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
return ((ret != 0xffffffff) && (isDir == 0));
|
||||||
#else
|
#else
|
||||||
wxStructStat stbuf;
|
wxStructStat stbuf;
|
||||||
if ( !filename.empty() && wxStat (OS_FILENAME(filename), &stbuf) == 0 )
|
if ( !filename.empty() && wxStat (OS_FILENAME(filename), &stbuf) == 0 )
|
||||||
@@ -1186,6 +1189,13 @@ bool wxPathExists(const wxChar *pszPathName)
|
|||||||
}
|
}
|
||||||
#endif // __WINDOWS__
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
// Stat can't cope with network paths
|
||||||
|
DWORD ret = GetFileAttributes(strPath.c_str());
|
||||||
|
DWORD isDir = (ret & FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
return ((ret != 0xffffffff) && (isDir != 0));
|
||||||
|
#else
|
||||||
|
|
||||||
wxStructStat st;
|
wxStructStat st;
|
||||||
#ifndef __VISAGECPP__
|
#ifndef __VISAGECPP__
|
||||||
return wxStat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 &&
|
return wxStat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 &&
|
||||||
@@ -1196,6 +1206,7 @@ bool wxPathExists(const wxChar *pszPathName)
|
|||||||
(st.st_mode == S_IFDIR);
|
(st.st_mode == S_IFDIR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a temporary filename, opening and closing the file.
|
// Get a temporary filename, opening and closing the file.
|
||||||
|
Reference in New Issue
Block a user