fixed wxIsPathSeparator() to work for Mac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13348 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -303,7 +303,14 @@ WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0);
|
|||||||
|
|
||||||
// is the char a path separator?
|
// is the char a path separator?
|
||||||
inline bool wxIsPathSeparator(wxChar c)
|
inline bool wxIsPathSeparator(wxChar c)
|
||||||
{ return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; }
|
{
|
||||||
|
// under DOS/Windows we should understand both Unix and DOS file separators
|
||||||
|
#if defined(__UNIX__) || defined(__MAC__)
|
||||||
|
return c == wxFILE_SEP_PATH;
|
||||||
|
#else
|
||||||
|
return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// does the string ends with path separator?
|
// does the string ends with path separator?
|
||||||
WXDLLEXPORT bool wxEndsWithPathSeparator(const wxChar *pszFileName);
|
WXDLLEXPORT bool wxEndsWithPathSeparator(const wxChar *pszFileName);
|
||||||
|
@@ -1519,11 +1519,9 @@ wxString wxGetOSDirectory()
|
|||||||
|
|
||||||
bool wxEndsWithPathSeparator(const wxChar *pszFileName)
|
bool wxEndsWithPathSeparator(const wxChar *pszFileName)
|
||||||
{
|
{
|
||||||
size_t len = wxStrlen(pszFileName);
|
size_t len = wxStrlen(pszFileName);
|
||||||
if ( len == 0 )
|
|
||||||
return FALSE;
|
return len && wxIsPathSeparator(pszFileName[len - 1]);
|
||||||
else
|
|
||||||
return wxIsPathSeparator(pszFileName[len - 1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find a file in a list of directories, returns false if not found
|
// find a file in a list of directories, returns false if not found
|
||||||
|
@@ -550,9 +550,9 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
|
|||||||
{
|
{
|
||||||
// default
|
// default
|
||||||
#ifdef __DOS__
|
#ifdef __DOS__
|
||||||
dir = _T(".");
|
dir = _T(".");
|
||||||
#else
|
#else
|
||||||
dir = _T("/tmp");
|
dir = _T("/tmp");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user