Removed 'release mode' and love.releaseerrhand, and added love.filesystem.isFused (resolves issue #579).

Games which are fused (either via appending the .love to the executable or with --fused) automatically have the changes which previously only applied to fused games in release mode.
This commit is contained in:
Alex Szpakowski
2013-08-05 15:02:50 -03:00
parent 4443284a73
commit fc3affb9b9
6 changed files with 36 additions and 216 deletions
+12 -14
View File
@@ -35,11 +35,9 @@ namespace physfs
{
Filesystem::Filesystem()
: open_count(0)
, buffer(0)
, initialized(false)
, release(false)
, releaseSet(false)
: initialized(false)
, fused(false)
, fusedSet(false)
{
}
@@ -61,19 +59,19 @@ void Filesystem::init(const char *arg0)
initialized = true;
}
void Filesystem::setRelease(bool release)
void Filesystem::setFused(bool fused)
{
if (releaseSet)
if (fusedSet)
return;
this->release = release;
releaseSet = true;
this->fused = fused;
fusedSet = true;
}
bool Filesystem::isRelease() const
bool Filesystem::isFused() const
{
if (!releaseSet)
if (!fusedSet)
return false;
return release;
return fused;
}
bool Filesystem::setIdentity(const char *ident, SearchOrder searchorder)
@@ -91,7 +89,7 @@ bool Filesystem::setIdentity(const char *ident, SearchOrder searchorder)
// Generate the full path to the game save folder.
save_path_full = std::string(getAppdataDirectory()) + std::string(LOVE_PATH_SEPARATOR);
if (release)
if (fused)
save_path_full += std::string(LOVE_APPDATA_PREFIX) + save_identity;
else
save_path_full += save_path_relative;
@@ -155,7 +153,7 @@ bool Filesystem::setupWriteDirectory()
// Create the save folder. (We're now "at" %APPDATA%).
bool success = false;
if (release)
if (fused)
success = mkdir(save_identity.c_str());
else
success = mkdir(save_path_relative.c_str());
+4 -10
View File
@@ -93,8 +93,8 @@ public:
void init(const char *arg0);
void setRelease(bool release);
bool isRelease() const;
void setFused(bool fused);
bool isFused() const;
/**
* This sets up the save directory. If the
@@ -280,12 +280,6 @@ public:
private:
// Counts open files.
int open_count;
// Pointer used for file reads.
char *buffer;
// Contains the current working directory (UTF8).
std::string cwd;
@@ -309,8 +303,8 @@ private:
// Allow saving outside of the LOVE_APPDATA_FOLDER
// for release 'builds'
bool release;
bool releaseSet;
bool fused;
bool fusedSet;
static StringMap<SearchOrder, SEARCH_ORDER_MAX_ENUM>::Entry orderEntries[];
static StringMap<SearchOrder, SEARCH_ORDER_MAX_ENUM> orders;
@@ -65,14 +65,20 @@ int w_init(lua_State *L)
return 0;
}
int w_setRelease(lua_State *L)
int w_setFused(lua_State *L)
{
// no error checking needed, everything, even nothing
// can be converted to a boolean
instance->setRelease(luax_toboolean(L, 1));
instance->setFused(luax_toboolean(L, 1));
return 0;
}
int w_isFused(lua_State *L)
{
luax_pushboolean(L, instance->isFused());
return 1;
}
int w_setIdentity(lua_State *L)
{
const char *arg = luaL_checkstring(L, 1);
@@ -541,7 +547,7 @@ int extloader(lua_State *L)
tokenized_name += library_extension();
void *handle = SDL_LoadObject((std::string(instance->getAppdataDirectory()) + LOVE_PATH_SEPARATOR LOVE_APPDATA_FOLDER LOVE_PATH_SEPARATOR + tokenized_name).c_str());
if (!handle && instance->isRelease())
if (!handle && instance->isFused())
handle = SDL_LoadObject((std::string(instance->getSaveDirectory()) + LOVE_PATH_SEPARATOR + tokenized_name).c_str());
if (!handle)
@@ -569,7 +575,8 @@ int extloader(lua_State *L)
static const luaL_Reg functions[] =
{
{ "init", w_init },
{ "setRelease", w_setRelease },
{ "setFused", w_setFused },
{ "isFused", w_isFused },
{ "setIdentity", w_setIdentity },
{ "getIdentity", w_getIdentity },
{ "setSource", w_setSource },
@@ -38,7 +38,8 @@ namespace physfs
bool hack_setupWriteDirectory();
int w_init(lua_State *L);
int w_setRelease(lua_State *L);
int w_setFused(lua_State *L);
int w_isFused(lua_State *L);
int w_setIdentity(lua_State *L);
int w_getIdentity(lua_State *L);
int w_setSource(lua_State *L);