diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-08 15:28:01 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-08 15:28:01 +0000 |
commit | dbb1ff3329acdd3917201535bd7b65737d76fdb6 (patch) | |
tree | 788d55a061126507e9e4b1fb65850613e691de09 /crawl-ref/source/macro.cc | |
parent | 9626f033179b75b07acba9ef9031aca0128b7456 (diff) | |
download | crawl-ref-dbb1ff3329acdd3917201535bd7b65737d76fdb6.tar.gz crawl-ref-dbb1ff3329acdd3917201535bd7b65737d76fdb6.zip |
Give a message when you don't succeed in writing a macro file.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8977 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/macro.cc')
-rw-r--r-- | crawl-ref/source/macro.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc index dd116d451d..c81dd4330c 100644 --- a/crawl-ref/source/macro.cc +++ b/crawl-ref/source/macro.cc @@ -597,10 +597,16 @@ static void write_map(std::ofstream &f, const macromap &mp, const char *key) /* * Saves macros into the macrofile, overwriting the old one. */ -void macro_save( void ) +void macro_save() { std::ofstream f; - f.open( get_macro_file().c_str() ); + const std::string macrofile = get_macro_file(); + f.open(macrofile.c_str()); + if (!f) + { + mprf(MSGCH_ERROR, "Couldn't open %s for writing!", macrofile.c_str()); + return; + } f << "# WARNING: This file is entirely auto-generated." << std::endl << std::endl << "# Key Mappings:" << std::endl; |