http://msdn.microsoft.com/en-us/library/aa365248(VS.85).aspx.
- wxPATH_MAC: Mac OS 8/9 and Mac OS X under CodeWarrior 7 format, absolute file
+ wxPATH_MAC: Mac OS 8/9 only, not used any longer, absolute file
names have the form
volume:dir1:...:dirN:filename
and the relative file names are either
#endif
#ifndef WX_PRECOMP
- #ifdef __WXMSW__
+ #ifdef __WINDOWS__
#include "wx/msw/wrapwin.h" // For GetShort/LongPathName
#endif
#include "wx/dynarray.h"
#include "wx/msw/gccpriv.h"
#endif
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
#include "wx/msw/private.h"
#endif
#include <unistd.h>
#endif
-#ifdef __MWERKS__
-#ifdef __MACH__
-#include <sys/types.h>
-#include <utime.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#else
-#include <stat.h>
-#include <unistd.h>
-#include <unix.h>
-#endif
-#endif
-
#ifdef __WATCOMC__
#include <io.h>
#include <sys/utime.h>
{
// Should the existence of file/directory with this name be accepted, i.e.
// result in the true return value from this function?
- const bool acceptFile = flags & wxFileSystemObject_File;
- const bool acceptDir = flags & wxFileSystemObject_Dir;
+ const bool acceptFile = (flags & wxFileSystemObject_File) != 0;
+ const bool acceptDir = (flags & wxFileSystemObject_Dir) != 0;
wxString strPath(path);
return wxFileSystemObjectExists(dirPath, wxFileSystemObject_Dir);
}
+/* static */
+bool wxFileName::Exists(const wxString& path)
+{
+ return wxFileSystemObjectExists(path, wxFileSystemObject_Any);
+}
+
// ----------------------------------------------------------------------------
// CWD and HOME stuff
// ----------------------------------------------------------------------------
}
#else // !HAVE_MKTEMP (includes __DOS__)
// generate the unique file name ourselves
- #if !defined(__DOS__) && (!defined(__MWERKS__) || defined(__DARWIN__) )
+ #if !defined(__DOS__)
path << (unsigned int)getpid();
#endif
bool wxFileName::Rmdir(const wxString& dir, int flags)
{
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
if ( flags & wxPATH_RMDIR_RECURSIVE )
{
// SHFileOperation needs double null termination string
return true;
}
else if ( flags & wxPATH_RMDIR_FULL )
-#else // !__WXMSW__
+#else // !__WINDOWS__
if ( flags != 0 ) // wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE
-#endif // !__WXMSW__
+#endif // !__WINDOWS__
{
wxString path(dir);
if ( path.Last() != wxFILE_SEP_PATH )
cont = d.GetNext(&filename);
}
-#ifndef __WXMSW__
+#ifndef __WINDOWS__
if ( flags & wxPATH_RMDIR_RECURSIVE )
{
// delete all files too
cont = d.GetNext(&filename);
}
}
-#endif // !__WXMSW__
+#endif // !__WINDOWS__
}
return ::wxRmdir(dir);
if ( fn1.GetFullPath() == fn2.GetFullPath() )
return true;
- // TODO: compare inodes for Unix, this works even when filenames are
- // different but files are the same (symlinks) (VZ)
+#if defined(__UNIX__)
+ wxStructStat st1, st2;
+ if ( wxStat(fn1.GetFullPath(), &st1) == 0 &&
+ wxStat(fn2.GetFullPath(), &st2) == 0 )
+ {
+ if ( st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev )
+ return true;
+ }
+ //else: It's not an error if one or both files don't exist.
+#endif // defined __UNIX__
return false;
}
{
wxString path(GetFullPath());
-#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
+#if defined(__WINDOWS__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
DWORD sz = ::GetShortPathName(path.t_str(), NULL, 0);
if ( sz != 0 )
{
{
if (format == wxPATH_NATIVE)
{
-#if defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__)
+#if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__)
format = wxPATH_DOS;
#elif defined(__VMS)
format = wxPATH_VMS;
wxStructStat stBuf;
if ( wxStat( GetFullPath(), &stBuf) == 0 )
{
+ // Android defines st_*time fields as unsigned long, but time_t as long,
+ // hence the static_casts.
if ( dtAccess )
- dtAccess->Set(stBuf.st_atime);
+ dtAccess->Set(static_cast<time_t>(stBuf.st_atime));
if ( dtMod )
- dtMod->Set(stBuf.st_mtime);
+ dtMod->Set(static_cast<time_t>(stBuf.st_mtime));
if ( dtCreate )
- dtCreate->Set(stBuf.st_ctime);
+ dtCreate->Set(static_cast<time_t>(stBuf.st_ctime));
return true;
}