X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d8a832f38ff0c3c1095b07de23cb2a7260ec7ff7..1a8e309166de13278b719b3dd8b9db73d4750bb2:/src/common/filename.cpp diff --git a/src/common/filename.cpp b/src/common/filename.cpp index e013b51163..12bc12daa7 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -68,15 +68,16 @@ #endif #ifndef WX_PRECOMP -#include "wx/intl.h" -#include "wx/log.h" -#include "wx/file.h" + #include "wx/dynarray.h" + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/file.h" + #include "wx/utils.h" #endif #include "wx/filename.h" #include "wx/tokenzr.h" #include "wx/config.h" // for wxExpandEnvVars -#include "wx/utils.h" #include "wx/file.h" #include "wx/dynlib.h" @@ -518,7 +519,7 @@ bool wxFileName::FileExists( const wxString &file ) bool wxFileName::DirExists() const { - return wxFileName::DirExists( GetFullPath() ); + return wxFileName::DirExists( GetPath() ); } bool wxFileName::DirExists( const wxString &dir ) @@ -561,7 +562,7 @@ wxString wxFileName::GetCwd(const wxString& volume) bool wxFileName::SetCwd() { - return wxFileName::SetCwd( GetFullPath() ); + return wxFileName::SetCwd( GetPath() ); } bool wxFileName::SetCwd( const wxString &cwd ) @@ -604,11 +605,25 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) // use the directory specified by the prefix SplitPath(prefix, &dir, &name, NULL /* extension */); + if (dir.empty()) + { + dir = wxGetenv(_T("TMPDIR")); + if (dir.empty()) + { + dir = wxGetenv(_T("TMP")); + if (dir.empty()) + { + dir = wxGetenv(_T("TEMP")); + } + } + } + #if defined(__WXWINCE__) if (dir.empty()) { // FIXME. Create \temp dir? - dir = wxT("\\"); + if (DirExists(wxT("\\temp"))) + dir = wxT("\\temp"); } path = dir + wxT("\\") + name; int i = 1; @@ -651,27 +666,14 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) #else // !Windows if ( dir.empty() ) { -#if defined(__WXMAC__) && !defined(__DARWIN__) - dir = wxMacFindFolder( (short) kOnSystemDisk, kTemporaryFolderType, kCreateFolder ) ; -#else // !Mac - dir = wxGetenv(_T("TMP")); - if ( dir.empty() ) - { - dir = wxGetenv(_T("TEMP")); - } - - if ( dir.empty() ) - { - // default - #if defined(__DOS__) || defined(__OS2__) - dir = _T("."); - #elif defined(__WXMAC__) - dir = wxMacFindFolder( (short) kOnSystemDisk, kTemporaryFolderType, kCreateFolder ) ; - #else - dir = _T("/tmp"); - #endif - } -#endif // Mac/!Mac + // default +#if defined(__DOS__) || defined(__OS2__) + dir = _T("."); +#elif defined(__WXMAC__) + dir = wxMacFindFolder(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder); +#else + dir = _T("/tmp"); +#endif } path = dir; @@ -752,9 +754,6 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) path = pathTry; #endif // HAVE_MKTEMP/!HAVE_MKTEMP - if ( !path.empty() ) - { - } #endif // HAVE_MKSTEMP/!HAVE_MKSTEMP #endif // Windows/!Windows @@ -800,7 +799,7 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) bool wxFileName::Mkdir( int perm, int flags ) { - return wxFileName::Mkdir( GetFullPath(), perm, flags ); + return wxFileName::Mkdir(GetPath(), perm, flags); } bool wxFileName::Mkdir( const wxString& dir, int perm, int flags ) @@ -851,7 +850,7 @@ bool wxFileName::Mkdir( const wxString& dir, int perm, int flags ) bool wxFileName::Rmdir() { - return wxFileName::Rmdir( GetFullPath() ); + return wxFileName::Rmdir( GetPath() ); } bool wxFileName::Rmdir( const wxString &dir ) @@ -1241,20 +1240,22 @@ wxString wxFileName::GetForbiddenChars(wxPathFormat format) } /* static */ -wxString wxFileName::GetVolumeSeparator(wxPathFormat format) +wxString wxFileName::GetVolumeSeparator(wxPathFormat WXUNUSED_IN_WINCE(format)) { +#ifdef __WXWINCE__ + return wxEmptyString; +#else wxString sepVol; -#ifndef __WXWINCE__ if ( (GetFormat(format) == wxPATH_DOS) || (GetFormat(format) == wxPATH_VMS) ) { sepVol = wxFILE_SEP_DSK; } //else: leave empty -#endif return sepVol; +#endif } /* static */ @@ -2047,7 +2048,6 @@ public : OSType m_creator ; } ; -#include "wx/dynarray.h" WX_DECLARE_OBJARRAY(MacDefaultExtensionRecord, MacDefaultExtensionArray) ; bool gMacDefaultExtensionsInited = false ;