#include <dirent.h>
#endif
+#ifdef __OS2__
+ #include <direct.h>
+ #include <process.h>
+#endif
#ifdef __WINDOWS__
#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
#include <direct.h>
bool
wxIsAbsolutePath (const wxString& filename)
{
- if (filename != "")
+ if (filename != _T(""))
{
if (filename[0] == _T('/')
#ifdef __VMS__
#endif
/* Expand inline environment variables */
+#ifdef __VISAGECPP__
+ while (*d)
+ {
+ *d++ = *s;
+ if(*s == _T('\\'))
+ {
+ *(d - 1) = *++s;
+ if (*d)
+ {
+ s++;
+ continue;
+ }
+ else
+ break;
+ }
+ else
+#else
while ((*d++ = *s)) {
-#ifndef __WXMSW__
+# ifndef __WXMSW__
if (*s == _T('\\')) {
if ((*(d - 1) = *++s)) {
s++;
} else
break;
} else
+# endif
#endif
#ifdef __WXMSW__
if (*s++ == _T('$') && (*s == _T('{') || *s == _T(')')))
register wxChar *start = d;
register int braces = (*s == _T('{') || *s == _T('('));
register wxChar *value;
+#ifdef __VISAGECPP__
+ // VA gives assignment in logical expr warning
+ while (*d)
+ *d++ = *s;
+#else
while ((*d++ = *s))
+#endif
if (braces ? (*s == _T('}') || *s == _T(')')) : !(wxIsalnum(*s) || *s == _T('_')) )
break;
else
*--d = 0;
value = wxGetenv(braces ? start + 1 : start);
if (value) {
+#ifdef __VISAGECPP__
+ // VA gives assignment in logical expr warning
+ for ((d = start - 1); (*d); *d++ = *value++);
+#else
for ((d = start - 1); (*d++ = *value++););
+#endif
d--;
if (braces && *s)
s++;
*(d - 1) = SEP;
}
s = nm;
+#ifdef __VISAGECPP__
+ // VA gives assignment in logical expr warning
+ while (*d)
+ *d++ = *s++;
+#else
while ((*d++ = *s++));
-
+#endif
delete[] nm_tmp; // clean up alloc
/* Now clean up the buffer */
return wxRealPath(buf);
#endif
return tcp + 1;
} /* while */
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
if (wxIsalpha (*path) && *(path + 1) == _T(':'))
return path + 2;
#endif
#endif
return wxString(tcp + 1);
} /* while */
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
if (wxIsalpha (*path) && *(path + 1) == _T(':'))
return wxString(path + 2);
#endif
else i --;
}
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
// Try Drive specifier
if (wxIsalpha (buf[0]) && buf[1] == _T(':'))
{
// Return just the directory, or NULL if no directory
wxString wxPathOnly (const wxString& path)
{
- if (path != "")
+ if (path != _T(""))
{
wxChar buf[_MAXPATHLEN];
else i --;
}
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
// Try Drive specifier
if (wxIsalpha (buf[0]) && buf[1] == _T(':'))
{
{
if (*s == _T('\\'))
*s = _T('/');
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
else
*s = wxTolower(*s); // Case INDEPENDENT
#endif
}
void
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
wxUnix2DosFilename (wxChar *s)
#else
wxUnix2DosFilename (wxChar *WXUNUSED(s))
#endif
{
// Yes, I really mean this to happen under DOS only! JACS
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
if (s)
while (*s)
{
const wxChar *dirname = dir.c_str();
#endif // Mac/!Mac
- // assume mkdir() has 2 args on non Windows platforms and on Windows too
+ // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too
// for the GNU compiler
-#if !defined(__WXMSW__) || (defined(__GNUWIN32__) && !defined(__MINGW32__))
+#if (!(defined(__WXMSW__) || defined(__WXPM__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__)
if ( mkdir(wxFNCONV(dirname), perm) != 0 )
-#else // MSW
- if ( mkdir(wxFNCONV(dirname)) != 0 )
+#else // MSW and OS/2
+ if ( mkdir(FNSTRINGCAST wxFNCONV(dirname)) != 0 )
#endif // !MSW/MSW
{
wxLogSysError(_("Directory '%s' couldn't be created"), dirname);
// does the path exists? (may have or not '/' or '\\' at the end)
bool wxPathExists(const wxChar *pszPathName)
{
- // Windows API returns -1 from stat for "c:\dir\" if "c:\dir" exists
- // OTOH, we should change "d:" to "d:\" and leave "\" as is.
+ /* Windows API returns -1 from stat for "c:\dir\" if "c:\dir" exists
+ * OTOH, we should change "d:" to "d:\" and leave "\" as is. */
wxString strPath(pszPathName);
if ( wxEndsWithPathSeparator(pszPathName) && pszPathName[1] != _T('\0') )
strPath.Last() = _T('\0');
}
#if wxUSE_UNICODE
else {
- wxConv_file.MB2WC(buf, cbuf, sz);
+ wxConvFile.MB2WC(buf, cbuf, sz);
delete [] cbuf;
}
#endif
bool wxSetWorkingDirectory(const wxString& d)
{
-#if defined( __UNIX__ ) || defined( __WXMAC__ )
- return (chdir(d.fn_str()) == 0);
+#if defined( __UNIX__ ) || defined( __WXMAC__ ) || defined(__WXPM__)
+ return (chdir(FNSTRINGCAST d.fn_str()) == 0);
#elif defined(__WINDOWS__)
#ifdef __WIN32__
#endif
}
-bool wxEndsWithPathSeparator(const char *pszFileName)
+bool wxEndsWithPathSeparator(const wxChar *pszFileName)
{
- size_t len = Strlen(pszFileName);
+ size_t len = wxStrlen(pszFileName);
if ( len == 0 )
return FALSE;
else
pDot = NULL;
}
#endif // MSW/Unix
-
+
if ( pDot < pLastSeparator )
{
// the dot is part of the path, not the start of the extension
if ( pstrPath )
{
- if ( pLastSeparator )
+ if ( pLastSeparator )
*pstrPath = wxString(pszFileName, pLastSeparator - pszFileName);
else
pstrPath->Empty();