summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/newgame.cc
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2009-09-30 00:17:16 -0700
committerSteven Noonan <steven@uplinklabs.net>2009-09-30 00:17:16 -0700
commita98267af0f2c0c556af7ea554c06245d33e04393 (patch)
tree7ab8d44f06293ee9d785e4cb88ad88b8f3f7f379 /crawl-ref/source/newgame.cc
parent70de00643f964fe0ef4b4f474b11e3ca986e39c9 (diff)
downloadcrawl-ref-a98267af0f2c0c556af7ea554c06245d33e04393.tar.gz
crawl-ref-a98267af0f2c0c556af7ea554c06245d33e04393.zip
files.cc, newgame.cc: support savegame paths with spaces in them
For instance, on Mac OS X, we save to this path: ~/Library/Application Support/Dungeon Crawl Stone Soup But if we just pass this path to an external program via system() without doing anything to it, the app assumes that spaces are intended to indicate separate parameters. We have to escape the paths in one of two ways. UNIX (backslashes): ~/This\ Crappy\ Path\ Has\ Spaces\ In\ It or Windows (doublequotes): "C:\This Crappy Path Has Spaces In It" Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r--crawl-ref/source/newgame.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index e65a8a3ddf..6708fa5a78 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -635,8 +635,10 @@ static bool _check_saved_game(void)
// Create command.
char cmd_buff[1024];
- const std::string directory = get_savedir();
+ std::string directory = get_savedir();
+ escape_path_spaces(basename);
+ escape_path_spaces(directory);
snprintf( cmd_buff, sizeof(cmd_buff), LOAD_UNPACKAGE_CMD,
basename.c_str(), directory.c_str() );