Update of /cvsroot/mahogany/M/src/classes
In directory sc8-pr-cvs1:/tmp/cvs-serv14201/src/classes

Modified Files:
        MApplication.cpp 
Log Message:
use APPDATA directory under Windows by default, not PROFILE (bug 778)

Index: MApplication.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/MApplication.cpp,v
retrieving revision 1.279
retrieving revision 1.280
diff -b -u -2 -r1.279 -r1.280
--- MApplication.cpp    19 Sep 2003 13:31:20 -0000      1.279
+++ MApplication.cpp    27 Sep 2003 23:13:26 -0000      1.280
@@ -63,4 +63,11 @@
 #include "wx/persctrl.h"      // for wxPControls::SetSettingsPath
 
+#ifdef OS_WIN
+   #include <shlobj.h>
+   #include <wx/msw/winundef.h>
+
+   #include <wx/dynlib.h>
+#endif // OS_WIN
+
 class MOption;
 
@@ -908,7 +915,31 @@
       m_localDir = wxGetHomeDir();
 
-#if defined(OS_UNIX)
+#ifdef OS_WIN
+      wxDynamicLibrary dllShell32(_T("shell32.dll"));
+      if ( dllShell32.IsLoaded() )
+      {
+         typedef BOOL (WINAPI *SHGetSpecialFolderPathA_t)(HWND, LPTSTR, int, BOOL);
+
+         wxDYNLIB_FUNCTION(SHGetSpecialFolderPathA_t, SHGetSpecialFolderPathA,
+                           dllShell32);
+
+         if ( pfnSHGetSpecialFolderPathA )
+         {
+            String pathAppData;
+            if ( pfnSHGetSpecialFolderPathA
+                    (
+                     NULL,                                  // owner hwnd
+                     wxStringBuffer(pathAppData, MAX_PATH), // [out] buffer
+                     CSIDL_APPDATA,                         // which to get
+                     FALSE                                  // don't create
+                    ) )
+            {
+               m_localDir = pathAppData;
+            }
+         }
+      }
+#endif // OS_WIN
+
       m_localDir << DIR_SEPARATOR << READ_APPCONFIG_TEXT(MP_USER_MDIR);
-#endif // OS
 
       // save it for the next runs
@@ -962,7 +993,5 @@
          else // under Windows, use the same directory as the local one
          {
-            // wxGetHomeDir() will usually return the directory where the
-            // program file is under Windows which is what we really want here
-            m_globalDir = wxGetHomeDir();
+            m_globalDir = m_localDir;
          }
 #endif // OS_WIN



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to