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

Closed
BlisterB opened this Issue Dec 30, 2015 · 8 comments

Projects

None yet

4 participants

@BlisterB
Member

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
Member
Ghabry commented Dec 30, 2015

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

@BlisterB
Member

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
Member
Ghabry commented Dec 30, 2015

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)

@Ghabry Ghabry added this to the 0.4.1 milestone Dec 30, 2015
@carstene1ns
Member

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 😀. However, this code might be useful here.

@BlisterB
Member

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
Member

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 Ghabry modified the milestone: 0.4.1, 0.5.0 Feb 19, 2016
@Ghabry
Member
Ghabry commented May 10, 2016

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 >.<

@Ghabry Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue May 14, 2016
@Ghabry Ghabry Change working directory on MacOS to the application directory when r…
…un from Finder. Fix #705
7da8896
@Ghabry Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue May 16, 2016
@Ghabry Ghabry Change working directory on MacOS to the application directory when r…
…un from Finder. Fix #705
dca19a4
@fdelapena fdelapena closed this in dbb08a4 May 29, 2016
@BlisterB
Member

This works like a charm :).

@Ghabry Ghabry modified the milestone: 0.5.0, 0.4.2 Jun 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment