#endif
#if defined(__WXMAC__)
- #include "wx/mac/private.h" // includes mac headers
+ #include "wx/osx/private.h" // includes mac headers
#endif
// utime() is POSIX so should normally be available on all Unices
#endif
-wxULongLong wxInvalidSize = (unsigned)-1;
+#if wxUSE_LONGLONG
+extern const wxULongLong wxInvalidSize = (unsigned)-1;
+#endif // wxUSE_LONGLONG
// ----------------------------------------------------------------------------
{
m_hFile = ::CreateFile
(
- filename, // name
+ filename.fn_str(), // name
mode == Read ? GENERIC_READ // access mask
: GENERIC_WRITE,
FILE_SHARE_READ | // sharing mode
DWORD attributes = FILE_ATTRIBUTE_TEMPORARY |
FILE_FLAG_DELETE_ON_CLOSE;
- HANDLE h = ::CreateFile(filename, access, 0, NULL,
+ HANDLE h = ::CreateFile(filename.fn_str(), access, 0, NULL,
disposition, attributes, NULL);
return wxOpenOSFHandle(h, wxO_BINARY);
}
#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__)
- if ( !::GetTempFileName(dir, name, 0, wxStringBuffer(path, MAX_PATH + 1)) )
+ if ( !::GetTempFileName(dir.fn_str(), name.fn_str(), 0,
+ wxStringBuffer(path, MAX_PATH + 1)) )
{
wxLogLastError(_T("GetTempFileName"));
// default
#if defined(__DOS__) || defined(__OS2__)
dir = _T(".");
-#elif defined(__WXMAC__)
+#elif defined(__WXMAC__) && !defined(__WXOSX_IPHONE__)
dir = wxMacFindFolder(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder);
#else
dir = _T("/tmp");
size_t count = dirs.GetCount();
for ( size_t i = 0; i < count; i++ )
{
- if ( i > 0 ||
-#if defined(__WXMAC__) && !defined(__DARWIN__)
- // relative pathnames are exactely the other way round under mac...
- !filename.IsAbsolute()
-#else
- filename.IsAbsolute()
-#endif
- )
+ if ( i > 0 || filename.IsAbsolute() )
currPath += wxFILE_SEP_PATH;
currPath += dirs[i];
}
}
- if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
- {
- dir.MakeLower();
- }
-
m_dirs.Add(dir);
}
wxString filename;
if (GetShortcutTarget(GetFullPath(format), filename))
{
- // Repeat this since we may now have a new path
- if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
- {
- filename.MakeLower();
- }
m_relative = false;
Assign(filename);
}
}
#endif
- if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
+#if defined(__WIN32__)
+ if ( (flags & wxPATH_NORM_LONG) && (format == wxPATH_DOS) )
{
- // VZ: expand env vars here too?
+ Assign(GetLongPath());
+ }
+#endif // Win32
+ // Change case (this should be kept at the end of the function, to ensure
+ // that the path doesn't change any more after we normalize its case)
+ if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
+ {
m_volume.MakeLower();
m_name.MakeLower();
m_ext.MakeLower();
- }
-#if defined(__WIN32__)
- if ( (flags & wxPATH_NORM_LONG) && (format == wxPATH_DOS) )
- {
- Assign(GetLongPath());
+ // directory entries must be made lower case as well
+ count = m_dirs.GetCount();
+ for ( size_t i = 0; i < count; i++ )
+ {
+ m_dirs[i].MakeLower();
+ }
}
-#endif // Win32
return true;
}
wxString path(GetFullPath());
#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
- DWORD sz = ::GetShortPathName(path, NULL, 0);
+ DWORD sz = ::GetShortPathName(path.fn_str(), NULL, 0);
if ( sz != 0 )
{
wxString pathOut;
if ( ::GetShortPathName
(
- path,
+ path.fn_str(),
wxStringBuffer(pathOut, sz),
sz
) != 0 )
#if defined(__WIN32__) && !defined(__WXWINCE__) && !defined(__WXMICROWIN__)
-#if wxUSE_DYNAMIC_LOADER
+#if wxUSE_DYNLIB_CLASS
typedef DWORD (WINAPI *GET_LONG_PATH_NAME)(const wxChar *, wxChar *, DWORD);
// this is MT-safe as in the worst case we're going to resolve the function
if ( s_pfnGetLongPathName )
{
- DWORD dwSize = (*s_pfnGetLongPathName)(path, NULL, 0);
+ DWORD dwSize = (*s_pfnGetLongPathName)(path.fn_str(), NULL, 0);
if ( dwSize > 0 )
{
if ( (*s_pfnGetLongPathName)
(
- path,
+ path.fn_str(),
wxStringBuffer(pathOut, dwSize),
dwSize
) != 0 )
}
}
}
-#endif // wxUSE_DYNAMIC_LOADER
+#endif // wxUSE_DYNLIB_CLASS
// The OS didn't support GetLongPathName, or some other error.
// We need to call FindFirstFile on each component in turn.
continue;
}
- hFind = ::FindFirstFile(tmpPath, &findFileData);
+ hFind = ::FindFirstFile(tmpPath.fn_str(), &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
// Error: most likely reason is that path doesn't exist, so
{
#if defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__)
format = wxPATH_DOS;
-#elif defined(__WXMAC__) && !defined(__DARWIN__)
- format = wxPATH_MAC;
#elif defined(__VMS)
format = wxPATH_VMS;
#else
// not 9x
bool ok;
FILETIME ftAccess, ftCreate, ftWrite;
- if ( IsDir() )
+ if ( IsDir() )
{
// implemented in msw/dir.cpp
extern bool wxGetDirectoryTimes(const wxString& dirname,
// file size functions
// ----------------------------------------------------------------------------
+#if wxUSE_LONGLONG
+
/* static */
wxULongLong wxFileName::GetSize(const wxString &filename)
{
return GetHumanReadableSize(GetSize(), failmsg, precision);
}
+#endif // wxUSE_LONGLONG
// ----------------------------------------------------------------------------
// Mac-specific functions
// ----------------------------------------------------------------------------
-#ifdef __WXMAC__
+#if defined( __WXMAC__ ) && !defined( __WXOSX_IPHONE__ )
const short kMacExtensionMaxLength = 16 ;
class MacDefaultExtensionRecord