mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 06:24:32 +00:00
show better errors when we fail to start up
This commit is contained in:
parent
af6c6a31aa
commit
f01db61292
8 changed files with 73 additions and 12 deletions
|
@ -23,6 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <assert.h>
|
||||
#include "OSFunctions.h"
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
#include "SDL_filesystem.h"
|
||||
#endif
|
||||
|
||||
#ifdef BBGE_BUILD_VFS
|
||||
# include "ttvfs.h"
|
||||
# ifndef VFS_IGNORE_CASE
|
||||
|
@ -253,10 +257,29 @@ bool exists(const std::string &f, bool makeFatal, bool skipVFS)
|
|||
|
||||
|
||||
|
||||
std::string getPathInfoStr()
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "Working dir (expecting game data there):\n" << getWorkingDir() << "\n";
|
||||
if(core)
|
||||
{
|
||||
os << "Preferences folder:\n" << core->getPreferencesFolder() << "\n";
|
||||
os << "User data folder:\n" << core->getUserDataFolder() << "\n";
|
||||
os << "Debug log path:\n" << core->getDebugLogPath() << "\n";
|
||||
}
|
||||
#if SDL_VERSION_ATLEAST(2,0,1)
|
||||
char *base = SDL_GetBasePath();
|
||||
os << "SDL_GetBasePath():\n" << base << "\n";
|
||||
SDL_free(base);
|
||||
#endif
|
||||
return os.str();
|
||||
}
|
||||
|
||||
void exit_error(const std::string &message)
|
||||
{
|
||||
fprintf(stderr, "FATAL: %s\n", message.c_str());
|
||||
errorLog(message);
|
||||
std::string out = message + "\n\n++ Path info for debugging aid: ++\n" + getPathInfoStr();
|
||||
fprintf(stderr, "FATAL: %s\n", out.c_str());
|
||||
errorLog(out);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue