#include "wx/utils.h"
#include "wx/intl.h"
-#include "wx/file.h"
+#include "wx/file.h" // This does include filefn.h
#include "wx/filename.h"
#include "wx/dir.h"
#include "wx/mac/private.h" // includes mac headers
#endif
-#ifdef __WXWINCE__
-#include "wx/msw/wince/time.h"
-#include "wx/msw/private.h"
-#else
-#include <time.h>
-#endif
-
-#ifdef __WXWINCE__
-// Nothing
-#elif !defined(__MWERKS__)
- #include <sys/types.h>
- #include <sys/stat.h>
-#else
-#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>
- #include <fcntl.h>
-#endif
-#endif
-
-#ifdef __OS2__
-// need to check for __OS2__ first since currently both
-// __OS2__ and __UNIX__ are defined.
- #include <process.h>
- #include "wx/os2/private.h"
-#ifdef __EMX__
- #include <unistd.h>
-#endif
-#elif defined(__UNIX__)
- #include <unistd.h>
- #include <dirent.h>
- #include <fcntl.h>
-#endif
-
-#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
-#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__)
- #include <direct.h>
- #include <dos.h>
- #include <io.h>
-#endif // __WINDOWS__
-#endif // native Win compiler
-
-#if defined(__DOS__)
- #ifdef __WATCOMC__
- #include <direct.h>
- #include <dos.h>
- #include <io.h>
- #endif
- #ifdef __DJGPP__
- #include <unistd.h>
- #endif
-#endif
-
-#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
- // this (3.1 I believe) and how to test for it.
- // If this works for Borland 4.0 as well, then no worries.
- #include <dir.h>
-#endif
-
-#ifdef __SALFORDC__
- #include <dir.h>
- #include <unix.h>
-#endif
-
#include "wx/log.h"
// No, Cygwin doesn't appear to have fnmatch.h after all.
#include "wx/msw/wrapwin.h"
#include "wx/msw/mslu.h"
- // for _getcwd
- #ifdef __MINGW32__
- #include <io.h>
- #endif
-
// sys/cygwin.h is needed for cygwin_conv_to_full_win32_path()
//
// note that it must be included after <windows.h>
trimchars[3] = 0;
#ifdef __WXMSW__
- const wxChar SEP = wxT('\\');
+ const wxChar SEP = wxT('\\');
#else
- const wxChar SEP = wxT('/');
+ const wxChar SEP = wxT('/');
#endif
buf[0] = wxT('\0');
if (name == NULL || *name == wxT('\0'))
#define kDefaultPathStyle kCFURLHFSPathStyle
#endif
-wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent )
+wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent )
{
- CFURLRef fullURLRef;
+ CFURLRef fullURLRef;
fullURLRef = CFURLCreateFromFSRef(NULL, fsRef);
if ( additionalPathComponent )
{
additionalPathComponent,false);
CFRelease( parentURLRef ) ;
}
- CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle);
- CFRelease( fullURLRef ) ;
- return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
+ CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle);
+ CFRelease( fullURLRef ) ;
+ return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
}
-OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
+OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
{
OSStatus err = noErr ;
- CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false);
- if ( NULL != url )
- {
- if ( CFURLGetFSRef(url, fsRef) == false )
- err = fnfErr ;
+ CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false);
+ if ( NULL != url )
+ {
+ if ( CFURLGetFSRef(url, fsRef) == false )
+ err = fnfErr ;
CFRelease( url ) ;
}
else
return err ;
}
-wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname )
+wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname )
{
CFStringRef cfname = CFStringCreateWithCharacters( kCFAllocatorDefault,
uniname->unicode,
*s = _T('/');
#ifdef __WXMSW__
else
- *s = wxTolower (*s); // Case INDEPENDENT
+ *s = (wxChar)wxTolower (*s); // Case INDEPENDENT
#endif
s++;
}
return false;
}
-#ifdef __UNIX__
// reset the umask as we want to create the file with exactly the same
// permissions as the original one
- mode_t oldUmask = umask( 0 );
-#endif // __UNIX__
+ wxCHANGE_UMASK(0);
// create file2 with the same permissions than file1 and open it for
// writing
if ( !fileOut.Create(file2, overwrite, fbuf.st_mode & 0777) )
return false;
-#ifdef __UNIX__
- /// restore the old umask
- umask(oldUmask);
-#endif // __UNIX__
-
// copy contents of file1 to file2
char buf[4096];
size_t count;
if ( getcwd( lbuf , sizeof( lbuf ) ) )
{
wxString res( lbuf , *wxConvCurrent ) ;
- wxStrcpy( buf , res ) ;
+ wxStrcpy( buf , res ) ;
ok = true;
}
else
APIRET rc;
ULONG ulDriveNum = 0;
ULONG ulDriveMap = 0;
- rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
+ rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
ok = rc == 0;
- if (ok)
- {
- sz -= 3;
- rc = ::DosQueryCurrentDir( 0 // current drive
+ if (ok)
+ {
+ sz -= 3;
+ rc = ::DosQueryCurrentDir( 0 // current drive
,cbuf + 3
,(PULONG)&sz
);
#elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__)
return (chdir(wxFNSTRINGCAST d.fn_str()) == 0);
#elif defined(__WINDOWS__)
-
+
#ifdef __WIN32__
#ifdef __WXWINCE__
// No equivalent in WinCE
if (isDriveSpec)
{
wxChar firstChar = d[0];
-
+
// To upper case
if (firstChar > 90)
firstChar = firstChar - 32;
-
+
// To a drive number
unsigned int driveNo = firstChar - 64;
if (driveNo > 0)
}
}
bool success = (chdir(WXSTRINGCAST d) == 0);
-
+
return success;
#endif
-
+
#endif
}
{
wxLogLastError(_T("FileTimeToLocalFileTime"));
}
-
+
SYSTEMTIME st;
if ( !::FileTimeToSystemTime(&ftLocal, &st) )
{
wxLogLastError(_T("FileTimeToSystemTime"));
}
-
+
dateTime.Set(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear,
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
return dateTime.GetTicks();