#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#if !defined(__WATCOMC__)
+#if !wxONLY_WATCOM_EARLIER_THAN(1,4)
#if !(defined(_MSC_VER) && (_MSC_VER > 800))
#include <errno.h>
#endif
wxString wxPathList::FindValidPath (const wxString& file)
{
- if (wxFileExists (wxExpandPath(wxFileFunctionsBuffer, file)))
- return wxString(wxFileFunctionsBuffer);
+ wxExpandPath(wxFileFunctionsBuffer, file);
wxChar buf[_MAXPATHLEN];
wxStrcpy(buf, wxFileFunctionsBuffer);
for (wxStringList::compatibility_iterator node = GetFirst(); node; node = node->GetNext())
{
- const wxChar *path = node->GetData();
+ const wxString path(node->GetData());
wxStrcpy (wxFileFunctionsBuffer, path);
wxChar ch = wxFileFunctionsBuffer[wxStrlen(wxFileFunctionsBuffer)-1];
if (ch != wxT('\\') && ch != wxT('/'))
#else // !__WIN32__
wxStructStat st;
#ifndef wxNEED_WX_UNISTD_H
- return wxStat( filename.fn_str() , &st) == 0 && (st.st_mode & S_IFREG);
+ return (wxStat( filename.fn_str() , &st) == 0 && (st.st_mode & S_IFREG))
+#ifdef __OS2__
+ || (errno == EACCES) // if access is denied something with that name
+ // exists and is opened in exclusive mode.
+#endif
+ ;
#else
return wxStat( filename , &st) == 0 && (st.st_mode & S_IFREG);
#endif
return (ret != (DWORD)-1) && (ret & FILE_ATTRIBUTE_DIRECTORY);
#elif defined(__OS2__)
- return (bool)(::DosSetCurrentDir((PSZ)(WXSTRINGCAST strPath)));
+ FILESTATUS3 Info = {{0}};
+ APIRET rc = ::DosQueryPathInfo((PSZ)(WXSTRINGCAST strPath), FIL_STANDARD,
+ (void*) &Info, sizeof(FILESTATUS3));
+
+ return ((rc == NO_ERROR) && (Info.attrFile & FILE_DIRECTORY)) ||
+ (rc == ERROR_SHARING_VIOLATION);
+ // If we got a sharing violation, there must be something with this name.
#else // !__WIN32__
wxStructStat st;
* Written By Douglas A. Lewis <dalewis@cs.Buffalo.EDU>
*
* The match procedure is public domain code (from ircII's reg.c)
+* but modified to suit our tastes (RN: No "%" syntax I guess)
*/
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
const wxChar *m = pat.c_str(),
*n = text.c_str(),
*ma = NULL,
- *na = NULL,
- *mp = NULL,
- *np = NULL;
+ *na = NULL;
int just = 0,
- pcount = 0,
acount = 0,
count = 0;
ma = ++m;
na = n;
just = 1;
- mp = NULL;
acount = count;
}
else if (*m == wxT('?'))
if (*m == *n)
{
m++;
- if (*n == wxT(' '))
- mp = NULL;
count++;
n++;
}
*/
if (!*n)
return false;
- if (mp)
- {
- m = mp;
- if (*np == wxT(' '))
- {
- mp = NULL;
- goto check_percent;
- }
- n = ++np;
- count = pcount;
- }
- else
- check_percent:
if (ma)
{