From 8ba5a61e227721c64a77d4811735e378218eb0d4 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Fri, 29 Dec 2006 07:23:23 +0000 Subject: Added morgue_dir as an init.txt option. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@718 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/macro.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/macro.cc') diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc index 9a80fe032a..2e322e4143 100644 --- a/crawl-ref/source/macro.cc +++ b/crawl-ref/source/macro.cc @@ -170,11 +170,17 @@ static int userfunc_getindex(const std::string &fname) */ static std::string get_macro_file() { - if (SysEnv.macro_file.length()) - return (SysEnv.macro_file); + std::string dir = + !Options.macro_dir.empty()? Options.macro_dir : + SysEnv.crawl_dir? SysEnv.crawl_dir : ""; - std::string s = SysEnv.crawl_dir? SysEnv.crawl_dir : ""; - return (s + "macro.txt"); + if (!dir.empty()) + { + if (dir[dir.length() - 1] != FILE_SEPARATOR) + dir += FILE_SEPARATOR; + } + + return (dir + "macro.txt"); } static void buf2keyseq(const char *buff, keyseq &k) -- cgit v1.2.3-54-g00ecf