MS-DOS fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -106,6 +106,12 @@
|
|||||||
#include <unix.h>
|
#include <unix.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WATCOMC__
|
||||||
|
#include <io.h>
|
||||||
|
#include <sys/utime.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -456,8 +462,8 @@ wxString wxFileName::CreateTempFileName(const wxString& prefix)
|
|||||||
#ifndef __WATCOMC__
|
#ifndef __WATCOMC__
|
||||||
::DosCreateDir(wxStringBuffer(MAX_PATH), NULL);
|
::DosCreateDir(wxStringBuffer(MAX_PATH), NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // !Windows, !OS/2
|
#else // !Windows, !OS/2, !DOS
|
||||||
if ( dir.empty() )
|
if ( dir.empty() )
|
||||||
{
|
{
|
||||||
dir = wxGetenv(_T("TMP"));
|
dir = wxGetenv(_T("TMP"));
|
||||||
@@ -469,7 +475,11 @@ wxString wxFileName::CreateTempFileName(const wxString& prefix)
|
|||||||
if ( dir.empty() )
|
if ( dir.empty() )
|
||||||
{
|
{
|
||||||
// default
|
// default
|
||||||
|
#ifdef __DOS__
|
||||||
|
dir = _T(".");
|
||||||
|
#else
|
||||||
dir = _T("/tmp");
|
dir = _T("/tmp");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,12 +488,24 @@ wxString wxFileName::CreateTempFileName(const wxString& prefix)
|
|||||||
if ( !wxEndsWithPathSeparator(dir) &&
|
if ( !wxEndsWithPathSeparator(dir) &&
|
||||||
(name.empty() || !wxIsPathSeparator(name[0u])) )
|
(name.empty() || !wxIsPathSeparator(name[0u])) )
|
||||||
{
|
{
|
||||||
path += _T('/');
|
path += wxFILE_SEP_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
path += name;
|
path += name;
|
||||||
|
|
||||||
#ifdef HAVE_MKSTEMP
|
#if defined(__DOS__) && defined(__WATCOMC__)
|
||||||
|
// scratch space for mkstemp()
|
||||||
|
path += _T("XXXXXX");
|
||||||
|
|
||||||
|
// can use the cast here because the length doesn't change and the string
|
||||||
|
// is not shared
|
||||||
|
if ( !_mktemp((char *)path.mb_str()) )
|
||||||
|
{
|
||||||
|
// this might be not necessary as mkstemp() on most systems should have
|
||||||
|
// already done it but it doesn't hurt neither...
|
||||||
|
path.clear();
|
||||||
|
}
|
||||||
|
#elif defined(HAVE_MKSTEMP)
|
||||||
// scratch space for mkstemp()
|
// scratch space for mkstemp()
|
||||||
path += _T("XXXXXX");
|
path += _T("XXXXXX");
|
||||||
|
|
||||||
@@ -1207,7 +1229,7 @@ wxPathFormat wxFileName::GetFormat( wxPathFormat format )
|
|||||||
{
|
{
|
||||||
if (format == wxPATH_NATIVE)
|
if (format == wxPATH_NATIVE)
|
||||||
{
|
{
|
||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__) || defined(__DOS__)
|
||||||
format = wxPATH_DOS;
|
format = wxPATH_DOS;
|
||||||
#elif defined(__WXMAC__) && !defined(__DARWIN__)
|
#elif defined(__WXMAC__) && !defined(__DARWIN__)
|
||||||
format = wxPATH_MAC;
|
format = wxPATH_MAC;
|
||||||
@@ -1395,7 +1417,7 @@ bool wxFileName::SetTimes(const wxDateTime *dtCreate,
|
|||||||
const wxDateTime *dtAccess,
|
const wxDateTime *dtAccess,
|
||||||
const wxDateTime *dtMod)
|
const wxDateTime *dtMod)
|
||||||
{
|
{
|
||||||
#if defined(__UNIX_LIKE__)
|
#if defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__))
|
||||||
if ( !dtAccess && !dtMod )
|
if ( !dtAccess && !dtMod )
|
||||||
{
|
{
|
||||||
// can't modify the creation time anyhow, don't try
|
// can't modify the creation time anyhow, don't try
|
||||||
@@ -1464,20 +1486,7 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess,
|
|||||||
wxDateTime *dtMod,
|
wxDateTime *dtMod,
|
||||||
wxDateTime *dtChange) const
|
wxDateTime *dtChange) const
|
||||||
{
|
{
|
||||||
#if defined(__UNIX_LIKE__)
|
#if defined(__UNIX_LIKE__) || defined(__WXMAC__) || (defined(__DOS__) && defined(__WATCOMC__))
|
||||||
wxStructStat stBuf;
|
|
||||||
if ( wxStat(GetFullPath(), &stBuf) == 0 )
|
|
||||||
{
|
|
||||||
if ( dtAccess )
|
|
||||||
dtAccess->Set(stBuf.st_atime);
|
|
||||||
if ( dtMod )
|
|
||||||
dtMod->Set(stBuf.st_mtime);
|
|
||||||
if ( dtChange )
|
|
||||||
dtChange->Set(stBuf.st_ctime);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#elif defined(__WXMAC__)
|
|
||||||
wxStructStat stBuf;
|
wxStructStat stBuf;
|
||||||
if ( wxStat(GetFullPath(), &stBuf) == 0 )
|
if ( wxStat(GetFullPath(), &stBuf) == 0 )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user