EasyRPG / Player

RPG Maker 2000/2003 and EasyRPG games interpreter
https://easyrpg.org/player/
GNU General Public License v3.0
966 stars 183 forks source link

OS X : Double click on the Player file doesn't find game #705

Closed BlisterB closed 8 years ago

BlisterB commented 8 years ago

When we double click on the easyrpg-player file, it launch the game browser, which doesn't find any game. We have to execute it with a terminal to launch the game or the game browser (which is abble to find games in this case).

Ghabry commented 8 years ago

The game browser finding only works when the browser is one directory above the games currently

BlisterB commented 8 years ago

There is a misunderstood, if the player is in a game folder, it launches the game browser (not the game) which found no game. If the player is in a folder containing games, it launch the game browser which found no game.

In all cases, the Player seems to not detect games if we execute it via a double click. But everything is fine when we execute it with a terminal.

Ghabry commented 8 years ago

Could you patch the player to output the working directory (getcwd()) on startup? And then give me the output for both cases (double click and console)

carstene1ns commented 8 years ago

The launcher (how is it called again, Finder?) will likely start in the home directory. I actually had this problem the other way around when packaging mkxp. It switches to the directory of the executable on startup to read configuration files and assets:

    /* set working directory */
    char *dataDir = SDL_GetBasePath();
    if (dataDir)
    {
        int result = chdir(dataDir);
        (void)result;
        SDL_free(dataDir);
    }

So when installed in /usr/bin this makes no sense :grinning:. However, this code might be useful here.

BlisterB commented 8 years ago

Ho nice ^^.

I've patched the Player as you asked me Ghabry. This is the result. Execution with terminal :

/Users/mehdi/Desktop/Dyhortfight2

Execution by double click :

/Users/mehdi
fdelapena commented 8 years ago

An OS X specific patch could compare user homedir, e.g. getenv("HOME") with the working directory, this hack probably would be reliable enough. The purpose of this condition is to prevent chdir when launched from command line from a different path.

Ghabry commented 8 years ago

Just got reminded of this. I don't like the SDL dependency but is a better short-term solution then trying to get the Objective C compiler working which is required for the MacOS API >.<

BlisterB commented 8 years ago

This works like a charm :).