DescentDevelopers / Descent3

Descent 3 by Outrage Entertainment
GNU General Public License v3.0
2.74k stars 231 forks source link

Get executable path for -useexedir #372

Closed JeodC closed 1 month ago

JeodC commented 1 month ago

Pull Request Type

Description

Actually retrieve the executable directory from a relative path so -useexedir functions. This was tested in windows where the realpath was S:\Descent 3\Descent3.exe and from a terminal in S:\ ran start ./Descent 3/Descent3.exe" --useexedir. Verified working.

Related Issues

Resolves #322 if Linux/MacOS are also functional. Needs testing.

JeodC commented 1 month ago

@Jayman2000 Can you try this and let me know if it works?

Lgt2x commented 1 month ago

Merged without approval

JeodC commented 1 month ago

Merged without approval

@jcoby Approved in comments. https://github.com/DescentDevelopers/Descent3/pull/372#discussion_r1606967495

Jayman2000 commented 1 month ago

Unfortunately, it looks like the final version of this PR introduced a new indentation mistake:

    if (!ddio_GetBinaryPath(exec_path, sizeof(exec_path))) {
    Error("Failed to get executable path\n");
    } else {
JeodC commented 1 month ago

Unfortunately, it looks like the final version of this PR introduced a new indentation mistake:


    if (!ddio_GetBinaryPath(exec_path, sizeof(exec_path))) {

    Error("Failed to get executable path\n");

    } else {

Dang it, missed one! I'll get it in a second pass the next time I touch init.cpp. Good catch.