]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filename.cpp
Added 'Back' to accelerator possibilities
[wxWidgets.git] / src / common / filename.cpp
index 757bba49a8bf58b855e776256bbd756057945dda..062ddc41fb7c7134d514b22f1cf3b61ece76201d 100644 (file)
@@ -619,21 +619,7 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
     }
 #endif // Win32/16
 
-#elif defined(__WXPM__)
-    // for now just create a file
-    //
-    // future enhancements can be to set some extended attributes for file
-    // systems OS/2 supports that have them (HPFS, FAT32) and security
-    // (HPFS386)
-    static const wxChar *szMktempSuffix = wxT("XXX");
-    path << dir << _T('/') << name << szMktempSuffix;
-
-    // Temporarily remove - MN
-    #ifndef __WATCOMC__
-        ::DosCreateDir(wxStringBuffer(path, MAX_PATH), NULL);
-    #endif
-
-#else // !Windows, !OS/2
+#else // !Windows
     if ( dir.empty() )
     {
 #if defined(__WXMAC__) && !defined(__DARWIN__)
@@ -648,7 +634,7 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
         if ( dir.empty() )
         {
             // default
-            #ifdef __DOS__
+            #if defined(__DOS__) || defined(__OS2__)
                 dir = _T(".");
             #else
                 dir = _T("/tmp");
@@ -723,7 +709,7 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
     for ( size_t n = 0; n < numTries; n++ )
     {
         // 3 hex digits is enough for numTries == 1000 < 4096
-        pathTry = path + wxString::Format(_T("%.03x"), n);
+        pathTry = path + wxString::Format(_T("%.03x"), (unsigned int) n);
         if ( !wxFile::Exists(pathTry) )
         {
             break;
@@ -1261,102 +1247,99 @@ wxString wxFileName::GetPath( int flags, wxPathFormat format ) const
         fullpath += wxGetVolumeString(GetVolume(), format);
     }
 
-    const size_t dirCount = m_dirs.GetCount();
-    if ( dirCount )
+    // the leading character
+    switch ( format )
     {
-        // the leading character
-        switch ( format )
-        {
-            case wxPATH_MAC:
-                if ( m_relative )
-                    fullpath += wxFILE_SEP_PATH_MAC;
-                break;
+        case wxPATH_MAC:
+            if ( m_relative )
+                fullpath += wxFILE_SEP_PATH_MAC;
+            break;
 
-            case wxPATH_DOS:
-                if ( !m_relative )
-                    fullpath += wxFILE_SEP_PATH_DOS;
-                break;
+        case wxPATH_DOS:
+            if ( !m_relative )
+                fullpath += wxFILE_SEP_PATH_DOS;
+            break;
 
-            default:
-                wxFAIL_MSG( wxT("Unknown path format") );
-                // fall through
+        default:
+            wxFAIL_MSG( wxT("Unknown path format") );
+            // fall through
 
-            case wxPATH_UNIX:
-                if ( !m_relative )
+        case wxPATH_UNIX:
+            if ( !m_relative )
+            {
+                // normally the absolute file names start with a slash
+                // with one exception: the ones like "~/foo.bar" don't
+                // have it
+                if ( m_dirs[0u] != _T('~') )
                 {
-                    // normally the absolute file names start with a slash
-                    // with one exception: the ones like "~/foo.bar" don't
-                    // have it
-                    if ( m_dirs[0u] != _T('~') )
-                    {
-                        fullpath += wxFILE_SEP_PATH_UNIX;
-                    }
+                    fullpath += wxFILE_SEP_PATH_UNIX;
                 }
-                break;
+            }
+            break;
 
-            case wxPATH_VMS:
-                // no leading character here but use this place to unset
-                // wxPATH_GET_SEPARATOR flag: under VMS it doesn't make sense
-                // as, if I understand correctly, there should never be a dot
-                // before the closing bracket
-                flags &= ~wxPATH_GET_SEPARATOR;
-        }
+        case wxPATH_VMS:
+            // no leading character here but use this place to unset
+            // wxPATH_GET_SEPARATOR flag: under VMS it doesn't make sense
+            // as, if I understand correctly, there should never be a dot
+            // before the closing bracket
+            flags &= ~wxPATH_GET_SEPARATOR;
+    }
 
-        // then concatenate all the path components using the path separator
-        if ( format == wxPATH_VMS )
-        {
-            fullpath += wxT('[');
-        }
+    if ( m_dirs.empty() )
+    {
+        // there is nothing more
+        return fullpath;
+    }
 
-        for ( size_t i = 0; i < dirCount; i++ )
-        {
-            switch (format)
-            {
-                case wxPATH_MAC:
-                    if ( m_dirs[i] == wxT(".") )
-                    {
-                        // skip appending ':', this shouldn't be done in this
-                        // case as "::" is interpreted as ".." under Unix
-                        continue;
-                    }
+    // then concatenate all the path components using the path separator
+    if ( format == wxPATH_VMS )
+    {
+        fullpath += wxT('[');
+    }
 
-                    // convert back from ".." to nothing
-                    if ( m_dirs[i] != wxT("..") )
-                         fullpath += m_dirs[i];
-                    break;
+    const size_t dirCount = m_dirs.GetCount();
+    for ( size_t i = 0; i < dirCount; i++ )
+    {
+        switch (format)
+        {
+            case wxPATH_MAC:
+                if ( m_dirs[i] == wxT(".") )
+                {
+                    // skip appending ':', this shouldn't be done in this
+                    // case as "::" is interpreted as ".." under Unix
+                    continue;
+                }
 
-                default:
-                    wxFAIL_MSG( wxT("Unexpected path format") );
-                    // still fall through
+                // convert back from ".." to nothing
+                if ( m_dirs[i] != wxT("..") )
+                     fullpath += m_dirs[i];
+                break;
 
-                case wxPATH_DOS:
-                case wxPATH_UNIX:
-                    fullpath += m_dirs[i];
-                    break;
+            default:
+                wxFAIL_MSG( wxT("Unexpected path format") );
+                // still fall through
 
-                case wxPATH_VMS:
-                    // TODO: What to do with ".." under VMS
+            case wxPATH_DOS:
+            case wxPATH_UNIX:
+                fullpath += m_dirs[i];
+                break;
 
-                    // convert back from ".." to nothing
-                    if ( m_dirs[i] != wxT("..") )
-                        fullpath += m_dirs[i];
-                    break;
-            }
+            case wxPATH_VMS:
+                // TODO: What to do with ".." under VMS
 
-            if ( (flags & wxPATH_GET_SEPARATOR) || (i != dirCount - 1) )
-                fullpath += GetPathSeparator(format);
+                // convert back from ".." to nothing
+                if ( m_dirs[i] != wxT("..") )
+                    fullpath += m_dirs[i];
+                break;
         }
 
-        if ( format == wxPATH_VMS )
-        {
-            fullpath += wxT(']');
-        }
+        if ( (flags & wxPATH_GET_SEPARATOR) || (i != dirCount - 1) )
+            fullpath += GetPathSeparator(format);
     }
-    else // no directories
+
+    if ( format == wxPATH_VMS )
     {
-        // still append path separator if requested
-        if ( flags & wxPATH_GET_SEPARATOR )
-            fullpath += GetPathSeparator(format);
+        fullpath += wxT(']');
     }
 
     return fullpath;
@@ -1529,7 +1512,7 @@ wxPathFormat wxFileName::GetFormat( wxPathFormat format )
 {
     if (format == wxPATH_NATIVE)
     {
-#if defined(__WXMSW__) || defined(__WXPM__) || defined(__DOS__)
+#if defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__)
         format = wxPATH_DOS;
 #elif defined(__WXMAC__) && !defined(__DARWIN__)
         format = wxPATH_MAC;