cmake build system + OS X support / cleanups for Humble Release #8
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <SDL2/SDL_filesystem.h>
|
||||||
|
|
||||||
#include <boost/program_options/options_description.hpp>
|
#include <boost/program_options/options_description.hpp>
|
||||||
#include <boost/program_options/parsers.hpp>
|
#include <boost/program_options/parsers.hpp>
|
||||||
#include <boost/program_options/variables_map.hpp>
|
#include <boost/program_options/variables_map.hpp>
|
||||||
|
@ -46,7 +48,13 @@ Config::Config()
|
||||||
solidFonts(false),
|
solidFonts(false),
|
||||||
gameFolder("."),
|
gameFolder("."),
|
||||||
allowSymlinks(false)
|
allowSymlinks(false)
|
||||||
{}
|
{
|
||||||
|
char *dataDir = SDL_GetBasePath();
|
||||||
|
if (dataDir) {
|
||||||
|
gameFolder = dataDir;
|
||||||
|
SDL_free(dataDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Config::read()
|
void Config::read()
|
||||||
{
|
{
|
||||||
|
@ -101,9 +109,9 @@ void Config::readGameINI()
|
||||||
{
|
{
|
||||||
if (!customScript.empty())
|
if (!customScript.empty())
|
||||||
{
|
{
|
||||||
size_t pos = customScript.find_last_of("/\\");
|
size_t pos = customScript.find_last_of("/\\");
|
||||||
if (pos == customScript.npos) pos = 0;
|
if (pos == customScript.npos) pos = 0;
|
||||||
game.title = customScript.substr(pos);
|
game.title = customScript.substr(pos);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -131,8 +139,8 @@ void Config::readGameINI()
|
||||||
strReplace(game.scripts, '\\', '/');
|
strReplace(game.scripts, '\\', '/');
|
||||||
|
|
||||||
if (game.title.empty()) {
|
if (game.title.empty()) {
|
||||||
size_t pos = gameFolder.find_last_of("/\\");
|
size_t pos = gameFolder.find_last_of("/\\");
|
||||||
if (pos == gameFolder.npos) pos = 0;
|
if (pos == gameFolder.npos) pos = 0;
|
||||||
game.title = gameFolder.substr(pos);
|
game.title = gameFolder.substr(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue