#endif
#endif
+#ifdef __EMX__
+#define MAX_PATH _MAX_PATH
+#endif
+
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
m_volume =
m_name =
m_ext = wxEmptyString;
+
+ // we don't have any absolute path for now
+ m_relative = TRUE;
}
/* static */
// scratch space for mkstemp()
path += _T("XXXXXX");
- // can use the cast here because the length doesn't change and the string
- // is not shared
- int fdTemp = mkstemp((char*)(const char *)path.mb_str());
+ // we need to copy the path to the buffer in which mkstemp() can modify it
+ wxCharBuffer buf = wxConvFile.cWX2MB( path );
+
+ // cast is safe because the string length doesn't change
+ int fdTemp = mkstemp( (char*)(const char*) buf );
if ( fdTemp == -1 )
{
// this might be not necessary as mkstemp() on most systems should have
}
else // mkstemp() succeeded
{
+ path = wxConvFile.cMB2WX( (const char*) buf );
+
// avoid leaking the fd
if ( fileTemp )
{
// same as above
path += _T("XXXXXX");
- if ( !mktemp((char *)path.mb_str()) )
+ wxCharBuffer buf = wxConvFile.cWX2MB( path );
+ if ( !mktemp( (const char*) buf ) )
{
path.clear();
}
+ else
+ {
+ path = wxConvFile.cMB2WX( (const char*) buf );
+ }
#else // !HAVE_MKTEMP (includes __DOS__)
// generate the unique file name ourselves
#ifndef __DOS__
// get cwd only once - small time saving
wxString cwd = wxGetCwd();
- Normalize(wxPATH_NORM_ALL, cwd, format);
- fnBase.Normalize(wxPATH_NORM_ALL, cwd, format);
+ Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format);
+ fnBase.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format);
bool withCase = IsCaseSensitive(format);
// get cwd only once - small time saving
wxString cwd = wxGetCwd();
- fn1.Normalize(wxPATH_NORM_ALL, cwd, format);
- fn2.Normalize(wxPATH_NORM_ALL, cwd, format);
+ fn1.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format);
+ fn2.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format);
if ( fn1.GetFullPath() == fn2.GetFullPath() )
return TRUE;
WIN32_FIND_DATA findFileData;
HANDLE hFind;
- pathOut = wxEmptyString;
+
+ if ( HasVolume() )
+ pathOut = GetVolume() +
+ GetVolumeSeparator(wxPATH_DOS) +
+ GetPathSeparator(wxPATH_DOS);
+ else
+ pathOut = wxEmptyString;
wxArrayString dirs = GetDirs();
dirs.Add(GetFullName());
if ( tmpPath.empty() )
continue;
- if ( tmpPath.Last() == wxT(':') )
+ // can't see this being necessary? MF
+ if ( tmpPath.Last() == GetVolumeSeparator(wxPATH_DOS) )
{
// Can't pass a drive and root dir to FindFirstFile,
// so continue to next dir
hFind = ::FindFirstFile(tmpPath, &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
- // Error: return immediately with the original path
- return path;
+ // Error: most likely reason is that path doesn't exist, so
+ // append any unprocessed parts and return
+ for ( i += 1; i < count; i++ )
+ tmpPath += wxFILE_SEP_PATH + dirs[i];
+
+ return tmpPath;
}
pathOut += findFileData.cFileName;
{
#if defined(__UNIX_LIKE__) || defined(__WXMAC__) || (defined(__DOS__) && defined(__WATCOMC__))
wxStructStat stBuf;
- if ( wxStat(GetFullPath().fn_str(), &stBuf) == 0 )
+ if ( wxStat( GetFullPath().c_str(), &stBuf) == 0 )
{
if ( dtAccess )
dtAccess->Set(stBuf.st_atime);
m_type = from.m_type ;
m_creator = from.m_creator ;
}
- MacDefaultExtensionRecord( char * extension , OSType type , OSType creator )
+ MacDefaultExtensionRecord( const char * extension , OSType type , OSType creator )
{
strncpy( m_ext , extension , kMacExtensionMaxLength ) ;
m_ext[kMacExtensionMaxLength] = 0 ;
{
if ( !gMacDefaultExtensionsInited )
{
-
+
// load the default extensions
MacDefaultExtensionRecord defaults[1] =
{
} ;
// we could load the pc exchange prefs here too
- for ( int i = 0 ; i < WXSIZEOF( defaults ) ; ++i )
+ for ( size_t i = 0 ; i < WXSIZEOF( defaults ) ; ++i )
{
gMacDefaultExtensions.Add( defaults[i] ) ;
}