Returns the name of the file that contains macros.
| 209 | |
| 210 | // Returns the name of the file that contains macros. |
| 211 | static string get_macro_file() |
| 212 | { |
| 213 | string dir = !Options.macro_dir.empty() ? Options.macro_dir : |
| 214 | !SysEnv.crawl_dir.empty() ? SysEnv.crawl_dir : ""; |
| 215 | |
| 216 | if (!dir.empty()) |
| 217 | { |
| 218 | #ifndef DGL_MACRO_ABSOLUTE_PATH |
| 219 | if (dir[dir.length() - 1] != FILE_SEPARATOR) |
| 220 | dir += FILE_SEPARATOR; |
| 221 | #endif |
| 222 | } |
| 223 | |
| 224 | #if defined(DGL_MACRO_ABSOLUTE_PATH) |
| 225 | return dir.empty()? "macro.txt" : dir; |
| 226 | #endif |
| 227 | |
| 228 | check_mkdir("Macro directory", &dir, true); |
| 229 | |
| 230 | #if defined(DGL_NAMED_MACRO_FILE) |
| 231 | return dir + strip_filename_unsafe_chars(you.your_name) + "-macro.txt"; |
| 232 | #else |
| 233 | return dir + "macro.txt"; |
| 234 | #endif |
| 235 | } |
| 236 | |
| 237 | static void buf2keyseq(const char *buff, keyseq &k) |
| 238 | { |
no test coverage detected