diff options
author | evktalo <evktalo@users.sourceforge.net> | 2009-09-30 11:33:06 +0300 |
---|---|---|
committer | evktalo <evktalo@users.sourceforge.net> | 2009-09-30 11:33:06 +0300 |
commit | 7082bff8e9f53dbb6bdb1bee1f290455fe52f20d (patch) | |
tree | 599713812829013374674b8c57e64a765abc12ad | |
parent | e7514fb6833394a5bc0a4c428666fb16ff947d29 (diff) | |
parent | d1e8257d2d9b9dd479c56026612f7a9d3dc16277 (diff) | |
download | crawl-ref-7082bff8e9f53dbb6bdb1bee1f290455fe52f20d.tar.gz crawl-ref-7082bff8e9f53dbb6bdb1bee1f290455fe52f20d.zip |
Merge branch 'master' of ssh://crawl-ref.git.sourceforge.net/gitroot/crawl-ref/crawl-ref
-rw-r--r-- | crawl-ref/source/Crawl.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | crawl-ref/source/files.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/libutil.cc | 30 | ||||
-rw-r--r-- | crawl-ref/source/libutil.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/makefile.unix | 2 | ||||
-rw-r--r-- | crawl-ref/source/makefile_tiles.mgw | 2 | ||||
-rw-r--r-- | crawl-ref/source/makefile_tiles.unix | 2 | ||||
-rw-r--r-- | crawl-ref/source/newgame.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/util/lua/src/Makefile | 2 | ||||
-rw-r--r-- | crawl-ref/source/util/sqlite/Makefile | 2 |
10 files changed, 52 insertions, 10 deletions
diff --git a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj index 4508c0a2cf..35a5bce4c5 100644 --- a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj +++ b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj @@ -841,6 +841,7 @@ B082656F10731A95006EEC5A /* libSQLite.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSQLite.a; sourceTree = BUILT_PRODUCTS_DIR; }; B082657610731AB5006EEC5A /* sqlite3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sqlite3.c; path = util/sqlite/sqlite3.c; sourceTree = "<group>"; }; B082657710731AB5006EEC5A /* sqlite3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqlite3.h; path = util/sqlite/sqlite3.h; sourceTree = "<group>"; }; + B0826648107333BB006EEC5A /* AppHdr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppHdr.h; sourceTree = "<group>"; }; B090C2EE10671F8900AE855D /* dngn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = dngn.png; path = rltiles/dngn.png; sourceTree = "<group>"; }; B090C2EF10671F8900AE855D /* gui.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = gui.png; path = rltiles/gui.png; sourceTree = "<group>"; }; B090C2F010671F8900AE855D /* main.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = main.png; path = rltiles/main.png; sourceTree = "<group>"; }; @@ -1064,6 +1065,7 @@ 7B352EF00B001F5B00CABB32 /* Crawl */ = { isa = PBXGroup; children = ( + B0826648107333BB006EEC5A /* AppHdr.h */, 7B237E0D0A8EC9D000580F30 /* abl-show.cc */, 7B237E290A8EC9D000580F30 /* abl-show.h */, 7B237E280A8EC9D000580F30 /* abyss.cc */, diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index e2fcef8895..3b27872c8e 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -693,12 +693,15 @@ std::vector<player_save_info> find_saved_characters() if (!is_packed_save(filename)) continue; - const std::string zipname = get_savedir_path(basename); + std::string zipname = get_savedir_path(basename); + escape_path_spaces(zipname); // This is the filename we actually read ourselves. filename = basename + ".sav"; + escape_path_spaces(filename); - const std::string dir = get_savedir(); + std::string dir = get_savedir(); + escape_path_spaces(dir); char cmd_buff[1024]; snprintf( cmd_buff, sizeof(cmd_buff), UNPACK_SPECIFIC_FILE_CMD, @@ -723,8 +726,10 @@ std::vector<player_save_info> find_saved_characters() filename.substr(0, filename.length() - strlen(".sav")); #endif - const std::string dollname = basename + ".tdl"; + std::string dollname = basename + ".tdl"; + const std::string dollpath = get_savedir_path(dollname); #ifdef LOAD_UNPACKAGE_CMD + escape_path_spaces(dollname); snprintf( cmd_buff, sizeof(cmd_buff), UNPACK_SPECIFIC_FILE_CMD, zipname.c_str(), @@ -732,7 +737,6 @@ std::vector<player_save_info> find_saved_characters() dollname.c_str() ); system(cmd_buff); #endif - const std::string dollpath = get_savedir_path(dollname); _fill_player_doll(p, dollpath); #ifdef LOAD_UNPACKAGE_CMD // Throw away doll file. @@ -1653,6 +1657,8 @@ void save_game(bool leave_game, const char *farewellmsg) #ifdef SAVE_PACKAGE_CMD std::string basename = get_savedir_filename(you.your_name, "", ""); + escape_path_spaces(basename); + char cmd_buff[1024]; snprintf( cmd_buff, sizeof(cmd_buff), diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index 58f6661805..d6064e7bbc 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -153,6 +153,36 @@ std::string make_stringf(const char *s, ...) return (buf); } +std::string &escape_path_spaces(std::string &s) +{ + std::string result; + result.clear(); +#ifdef UNIX + for (const char* ch = s.c_str(); *ch != '\0'; ++ch) + { + if (*ch == ' ') + { + result += '\\'; + } + result += *ch; + } +#elif defined(WIN32CONSOLE) || defined(WIN32TILES) + if (s.find(" ") != std::string::npos && + s.find("\"") == std::string::npos) + { + result = "\"" + s + "\""; + } else { + return s; + } +#else + // Not implemented for this platform. Assume that + // escaping isn't necessary. + return s; +#endif + s = result; + return s; +} + std::string &uppercase(std::string &s) { for (unsigned i = 0, sz = s.size(); i < sz; ++i) diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h index f64e8ae07c..d3e02628e4 100644 --- a/crawl-ref/source/libutil.h +++ b/crawl-ref/source/libutil.h @@ -28,6 +28,8 @@ std::string apply_description(description_level_type desc, description_level_type description_type_by_name(const char *desc); +std::string &escape_path_spaces(std::string &s); + std::string lowercase_string(std::string s); std::string &lowercase(std::string &s); std::string &uppercase(std::string &s); diff --git a/crawl-ref/source/makefile.unix b/crawl-ref/source/makefile.unix index 67f994ee0e..f8fc9e30eb 100644 --- a/crawl-ref/source/makefile.unix +++ b/crawl-ref/source/makefile.unix @@ -12,7 +12,7 @@ include makefile.obj OBJECTS += libunix.o crash-u.o -CXX ?= g++ +CXX = g++ DELETE = rm -f COPY = cp OS_TYPE = UNIX diff --git a/crawl-ref/source/makefile_tiles.mgw b/crawl-ref/source/makefile_tiles.mgw index 8110433f4d..93fe6eaeb0 100644 --- a/crawl-ref/source/makefile_tiles.mgw +++ b/crawl-ref/source/makefile_tiles.mgw @@ -11,7 +11,7 @@ endif # need .exe so make will find the right file APPNAME = $(OPATH)\crawl.exe -CXX ?= g++ +CXX = g++ DELETE = del COPY = copy OS_TYPE = WIN32TILES diff --git a/crawl-ref/source/makefile_tiles.unix b/crawl-ref/source/makefile_tiles.unix index 7d199d0f21..fe968520d1 100644 --- a/crawl-ref/source/makefile_tiles.unix +++ b/crawl-ref/source/makefile_tiles.unix @@ -14,7 +14,7 @@ OBJECTS += libgui.o tilepick.o tile2.o tilereg.o tilesdl.o tilefont.o tiletex.o SDL_CFLAGS := $(shell sdl-config --cflags) -CXX ?= g++ +CXX = g++ DELETE = rm -f COPY = cp OS_TYPE = UNIX 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() ); diff --git a/crawl-ref/source/util/lua/src/Makefile b/crawl-ref/source/util/lua/src/Makefile index 000555fae7..d5f5222207 100644 --- a/crawl-ref/source/util/lua/src/Makefile +++ b/crawl-ref/source/util/lua/src/Makefile @@ -9,7 +9,7 @@ # Your platform. See PLATS for possible values. PLAT= none -CC ?= gcc +CC= gcc CFLAGS= -O2 -Wall $(MYCFLAGS) AR= ar rcu RANLIB= ranlib diff --git a/crawl-ref/source/util/sqlite/Makefile b/crawl-ref/source/util/sqlite/Makefile index 520bd75714..2bc3970561 100644 --- a/crawl-ref/source/util/sqlite/Makefile +++ b/crawl-ref/source/util/sqlite/Makefile @@ -4,7 +4,7 @@ LIBSQL = libsqlite3.a AR = ar rcu -CC ?= gcc +CC = gcc RANLIB = ranlib RM_F = rm -f |