]> git.saurik.com Git - wxWidgets.git/commitdiff
path/file corrections for Darwin/Mac OS X
authorGilles Depeyrot <gilles_depeyrot@mac.com>
Mon, 29 Oct 2001 22:26:59 +0000 (22:26 +0000)
committerGilles Depeyrot <gilles_depeyrot@mac.com>
Mon, 29 Oct 2001 22:26:59 +0000 (22:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12202 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/fileconf.cpp
src/mac/carbon/utils.cpp
src/mac/utils.cpp
src/unix/utilsunx.cpp

index 32f6cd69d81d857a739d78f14f0e1b2ae1fd3014..dff486f87612ed5afdf42394f2d71c2500db8f74 100644 (file)
@@ -257,7 +257,7 @@ wxString wxFileConfig::GetGlobalDir()
   #ifdef __VMS__ // Note if __VMS is defined __UNIX is also defined
     strDir = wxT("sys$manager:");
   #elif defined(__WXMAC__)
-       strDir = wxMacFindFolder(  (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
+    strDir = wxMacFindFolder(  (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
   #elif defined( __UNIX__ )
     strDir = wxT("/etc/");
   #elif defined(__WXPM__)
@@ -368,20 +368,20 @@ wxString wxFileConfig::GetLocalDir()
 {
   wxString strDir;
 
-#ifndef __WXMAC__
+#if defined(__WXMAC__)
+  // no local dir concept on Mac OS 9
+  return GetGlobalDir() ;
+#else
   wxGetHomeDir(&strDir);
 
-#ifdef  __UNIX__
-#ifdef __VMS
-   if (strDir.Last() != wxT(']'))
-#endif
-   if (strDir.Last() != wxT('/')) strDir << wxT('/');
-#else
+#  ifdef  __UNIX__
+#  ifdef __VMS
+  if (strDir.Last() != wxT(']'))
+#  endif
+      if (strDir.Last() != wxT('/')) strDir << wxT('/');
+#  else
   if (strDir.Last() != wxT('\\')) strDir << wxT('\\');
-#endif
-#else
-       // no local dir concept on mac
-       return GetGlobalDir() ;
+#  endif
 #endif
 
   return strDir;
@@ -393,10 +393,10 @@ wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile)
   str << szFile;
 
   if ( wxStrchr(szFile, wxT('.')) == NULL )
-  #ifdef  __UNIX__
-    str << wxT(".conf");
-  #elif defined( __WXMAC__ )
+  #if defined( __WXMAC__ )
      str << " Preferences";
+  #elif defined( __UNIX__ )
+    str << wxT(".conf");
   #else   // Windows
     str << wxT(".ini");
   #endif  // UNIX/Win
@@ -414,7 +414,7 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile)
    wxString str = GetLocalDir();
 #endif
    
-  #if defined( __UNIX__ ) && !defined( __VMS )
+  #if defined( __UNIX__ ) && !defined( __VMS ) && !defined( __WXMAC__ )
     str << wxT('.');
   #endif
 
@@ -425,7 +425,6 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile)
       str << wxT(".ini");
   #endif
 
-
   #ifdef __WXMAC__
      str << " Preferences";
   #endif
@@ -950,7 +949,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
 
   bool ret = file.Commit();
 
-#if defined(__WXMAC__) && !defined(__UNIX__)
+#if defined(__WXMAC__)
   if ( ret )
   {
        FSSpec spec ;
@@ -964,7 +963,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
                FSpSetFInfo( &spec , &finfo ) ;
        }
   }
-#endif // __WXMAC__ && !__UNIX__
+#endif // __WXMAC__
 
 #ifdef __UNIX__
   // restore the old umask if we changed it
index 56c404aa9972d5348a9ea22f2af82de740b1c99b..95efb40dbbc4e9ab71977b0219cb46454c643006 100644 (file)
@@ -11,7 +11,6 @@
 
 #ifdef __GNUG__
 // Note: this is done in utilscmn.cpp now.
-// #pragma implementation
 // #pragma implementation "utils.h"
 #endif
 
@@ -130,11 +129,11 @@ long wxGetFreeMemory()
 
 void wxUsleep(unsigned long milliseconds)
 {
-               clock_t start = clock() ;
-               do 
-               {
-                       YieldToAnyThread() ;
-               } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
+    clock_t start = clock() ;
+    do 
+    {
+       YieldToAnyThread() ;
+    } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
 }
 
 void wxSleep(int nSecs)
@@ -318,9 +317,9 @@ bool wxIsBusy()
   return (wxBusyCursorCount > 0);
 }
 
-wxString wxMacFindFolder( short                                        vol,
-                                                                OSType                                 folderType,
-                                                                Boolean                                createFolder)
+wxString wxMacFindFolder( short        vol,
+                         OSType       folderType,
+                         Boolean      createFolder)
 {
        short           vRefNum  ;
        long            dirID ;
@@ -331,7 +330,7 @@ wxString wxMacFindFolder( short                                     vol,
                FSSpec file ;
                if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
                {
-                       strDir = wxMacFSSpec2MacFilename( &file ) + ":" ;
+                       strDir = wxMacFSSpec2MacFilename( &file ) + wxFILE_SEP_PATH ;
                }
        }
        return strDir ;
@@ -343,7 +342,6 @@ char *wxGetUserHome (const wxString& user)
     // TODO
     return NULL;
 }
-#endif
 
 bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 {
@@ -378,6 +376,7 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 
     return err == noErr ;
 }
+#endif
 
 // Check whether this window wants to process messages, e.g. Stop button
 // in long calculations.
index 56c404aa9972d5348a9ea22f2af82de740b1c99b..95efb40dbbc4e9ab71977b0219cb46454c643006 100644 (file)
@@ -11,7 +11,6 @@
 
 #ifdef __GNUG__
 // Note: this is done in utilscmn.cpp now.
-// #pragma implementation
 // #pragma implementation "utils.h"
 #endif
 
@@ -130,11 +129,11 @@ long wxGetFreeMemory()
 
 void wxUsleep(unsigned long milliseconds)
 {
-               clock_t start = clock() ;
-               do 
-               {
-                       YieldToAnyThread() ;
-               } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
+    clock_t start = clock() ;
+    do 
+    {
+       YieldToAnyThread() ;
+    } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
 }
 
 void wxSleep(int nSecs)
@@ -318,9 +317,9 @@ bool wxIsBusy()
   return (wxBusyCursorCount > 0);
 }
 
-wxString wxMacFindFolder( short                                        vol,
-                                                                OSType                                 folderType,
-                                                                Boolean                                createFolder)
+wxString wxMacFindFolder( short        vol,
+                         OSType       folderType,
+                         Boolean      createFolder)
 {
        short           vRefNum  ;
        long            dirID ;
@@ -331,7 +330,7 @@ wxString wxMacFindFolder( short                                     vol,
                FSSpec file ;
                if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
                {
-                       strDir = wxMacFSSpec2MacFilename( &file ) + ":" ;
+                       strDir = wxMacFSSpec2MacFilename( &file ) + wxFILE_SEP_PATH ;
                }
        }
        return strDir ;
@@ -343,7 +342,6 @@ char *wxGetUserHome (const wxString& user)
     // TODO
     return NULL;
 }
-#endif
 
 bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 {
@@ -378,6 +376,7 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 
     return err == noErr ;
 }
+#endif
 
 // Check whether this window wants to process messages, e.g. Stop button
 // in long calculations.
index 9ff30199ca6138fa76e439e253d7f10942ebae4c..ffbde3589f2f1224a7cbf9b62d25ed26e7ea1479 100644 (file)
@@ -1011,7 +1011,6 @@ long wxGetFreeMemory()
     return -1;
 }
 
-#ifndef __WXMAC__
 bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 {
 #if defined(HAVE_STATFS) || defined(HAVE_STATVFS)
@@ -1041,7 +1040,6 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 
     return FALSE;
 }
-#endif
 
 // ----------------------------------------------------------------------------
 // env vars