diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-08 00:25:58 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-08 00:25:58 +0000 |
commit | d0650b984a9d22727429bceb1d51a3dfb8aa84ef (patch) | |
tree | fc2affc4477918b9935d69433c8a822fcfd5c3c6 /crawl-ref/source/libgui.cc | |
parent | 12c06e3c2402f48325bf48d31e588af5ccab1c08 (diff) | |
download | crawl-ref-d0650b984a9d22727429bceb1d51a3dfb8aa84ef.tar.gz crawl-ref-d0650b984a9d22727429bceb1d51a3dfb8aa84ef.zip |
Save macro.txt and wininit.txt in the settings folder, both using the
macro_dir option. We might want to rename said option.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6447 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libgui.cc')
-rw-r--r-- | crawl-ref/source/libgui.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index 8b5ae1db7f..6fb7c56f7e 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -28,6 +28,7 @@ #include "it_use2.h" #include "externs.h" #include "guic.h" +#include "initfile.h" #include "message.h" #include "misc.h" #include "mon-util.h" @@ -804,8 +805,23 @@ static void _libgui_save_prefs() strncpy(dummy_str[pref_mode][idx], (char *)p->ptr, MAX_PREF_CHAR); } + // Use the same directory as for macros. + // (Yes, this is an arbitrary decision.) + std::string dir = !Options.macro_dir.empty() ? Options.macro_dir : + !SysEnv.crawl_dir.empty() ? SysEnv.crawl_dir : ""; + + if (!dir.empty()) + { +#ifndef DGL_MACRO_ABSOLUTE_PATH + if (dir[dir.length() - 1] != FILE_SEPARATOR) + dir += FILE_SEPARATOR; +#endif + } + const char *baseTxt = "wininit.txt"; - std::string winTxtString = datafile_path(baseTxt, false, true); + std::string winTxtString = dir + baseTxt; + if ( (fp = fopen(winTxtString.c_str(), "w")) == NULL ) + winTxtString = datafile_path(baseTxt, false, true); const char *winTxt = winTxtString.c_str()[0] == 0 ? baseTxt : winTxtString.c_str(); |