From dbb1ff3329acdd3917201535bd7b65737d76fdb6 Mon Sep 17 00:00:00 2001 From: haranp Date: Sun, 8 Feb 2009 15:28:01 +0000 Subject: 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 --- crawl-ref/source/macro.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/macro.cc') 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; -- cgit v1.2.3-54-g00ecf