change to exe dir on startup and add some extra guards around boost program option parsing.
This commit is contained in:
parent
e87bdb8a95
commit
a18497ca7b
2 changed files with 27 additions and 21 deletions
src
23
src/main.cpp
23
src/main.cpp
|
@ -232,18 +232,27 @@ int rgssThreadFun(void *userdata)
|
|||
|
||||
int main(int, char *argv[])
|
||||
{
|
||||
// initialize SDL first
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
||||
{
|
||||
Debug() << "Error initializing SDL:" << SDL_GetError();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// set working directory
|
||||
char *dataDir = SDL_GetBasePath();
|
||||
if (dataDir) {
|
||||
chdir(dataDir);
|
||||
SDL_free(dataDir);
|
||||
}
|
||||
|
||||
// now we load the config
|
||||
Config conf;
|
||||
|
||||
conf.read();
|
||||
conf.readGameINI();
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
||||
{
|
||||
Debug() << "Error initializing SDL:" << SDL_GetError();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int imgFlags = IMG_INIT_PNG | IMG_INIT_JPG;
|
||||
if (IMG_Init(imgFlags) != imgFlags)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue