diff options
| author | jacob1 <jfu614@gmail.com> | 2012-10-19 23:17:15 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-10-26 14:15:38 (GMT) |
| commit | 3a29fc0268dbda68e80f7de586c6692ba7a11565 (patch) | |
| tree | fa2ae1ded7149c2b56c4dcecac032e991b30d00e /src/cat | |
| parent | e2622657f076ef943d051593d0969306daf15f32 (diff) | |
| download | powder-3a29fc0268dbda68e80f7de586c6692ba7a11565.zip powder-3a29fc0268dbda68e80f7de586c6692ba7a11565.tar.gz | |
Save local saves as current name option (overwrites them automatically). Fix filename not showing when first saving a local save
Diffstat (limited to 'src/cat')
| -rw-r--r-- | src/cat/LegacyLuaAPI.cpp | 11 | ||||
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 8 |
2 files changed, 3 insertions, 16 deletions
diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp index dfebf01..d6e6ce6 100644 --- a/src/cat/LegacyLuaAPI.cpp +++ b/src/cat/LegacyLuaAPI.cpp @@ -16,11 +16,6 @@ #include "simulation/Simulation.h" #include "game/GameModel.h" -#ifdef WIN -#include <direct.h> -#else -#include <sys/stat.h> -#endif #include <time.h> #ifndef FFI @@ -1747,11 +1742,7 @@ int luatpt_getscript(lua_State* l) filename = new char[fileauthor.length()+fileid.length()+strlen(PATH_SEP)+strlen(LOCAL_LUA_DIR)+6]; sprintf(filename, LOCAL_LUA_DIR PATH_SEP "%s_%s.lua", fileauthor.c_str(), fileid.c_str()); -#ifdef WIN - _mkdir(LOCAL_LUA_DIR); -#else - mkdir(LOCAL_LUA_DIR, 0755); -#endif + Client::Ref().MakeDirectory(LOCAL_LUA_DIR); outputfile = fopen(filename, "r"); if(outputfile) diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index b9124c5..56da7e0 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -1520,14 +1520,10 @@ int LuaScriptInterface::fileSystem_isDirectory(lua_State * l) int LuaScriptInterface::fileSystem_makeDirectory(lua_State * l) { - const char * filename = lua_tostring(l, 1); + const char * dirname = lua_tostring(l, 1); int ret = 0; -#ifdef WIN - ret = _mkdir(filename); -#else - ret = mkdir(filename, 0755); -#endif + ret = Client::Ref().MakeDirectory(dirname); lua_pushboolean(l, ret == 0); return 1; } |
