/[enigma]/enigma/src/options.cc
ViewVC logotype

Diff of /enigma/src/options.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by mhawlisch, Wed Feb 26 16:15:44 2003 UTC revision 1.6 by mhawlisch, Tue Mar 18 12:11:34 2003 UTC
# Line 16  Line 16 
16   * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.   * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17   */   */
18  #include "enigma.hh"  #include "enigma.hh"
19    #ifdef __MINGW32__
20        #include <windows.h>
21        #include <shlobj.h>
22    #endif
23  #include "lua.hh"  #include "lua.hh"
24  #include "options.hh"  #include "options.hh"
25  #include "system.hh"  #include "system.hh"
# Line 130  System_ConfigurationFileName() Line 134  System_ConfigurationFileName()
134      return enigma::FindDataFile ("enigma_conf.lua");      return enigma::FindDataFile ("enigma_conf.lua");
135  }  }
136    
137    #ifdef __MINGW32__
138    
139    static string
140    Windows_ConfigurationFileName()
141    {
142        TCHAR szPath[MAX_PATH];
143        if ( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA,
144                                         NULL, 0, szPath)))
145        {
146            return string(szPath) + "/enigmarc.lua";
147        }
148    
149        // Fallback to MyDocuments
150        if ( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PERSONAL,
151                                         NULL, 0, szPath)))
152        {
153            return string(szPath) + "/enigmarc.lua";
154        }
155    
156        return Personal_ConfigurationFileName();
157    }
158    
159    #endif
160    
161    
162  bool  bool
163  options::Save ()  options::Save ()
164  {  {
165    #ifdef __MINGW32__
166        string fname = Windows_ConfigurationFileName();
167    #else
168      string fname = Personal_ConfigurationFileName();      string fname = Personal_ConfigurationFileName();
169    #endif
170      FILE *fp = fopen(fname.c_str(), "wt");      FILE *fp = fopen(fname.c_str(), "wt");
171            
172      if (fp) {      if (fp) {
# Line 187  options::Load () Line 220  options::Load ()
220      fname = Personal_ConfigurationFileName();      fname = Personal_ConfigurationFileName();
221      error |= load_from_file (fname.c_str());      error |= load_from_file (fname.c_str());
222    
223    #ifdef __MINGW32__
224        fname = Windows_ConfigurationFileName();
225        error |= load_from_file (fname.c_str());
226    #endif
227    
228      return error;      return error;
229  }  }
230    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26