Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start dethrace from terminal (Windows) #351

Closed
madebr opened this issue Sep 18, 2023 · 5 comments · Fixed by #381
Closed

Cannot start dethrace from terminal (Windows) #351

madebr opened this issue Sep 18, 2023 · 5 comments · Fixed by #381

Comments

@madebr
Copy link
Collaborator

madebr commented Sep 18, 2023

From discord:

strangely enough, on windows 10, running dethrace.exe directly from the explorer window works, but starting it from the command line doesn't :

D:\Carmageddon>Dethrace version: 8051ca2
Using root directory:
[PANIC] Harness_Init Failed to chdir. Error is Invalid argument
@PierreMarieBaty
Copy link

PierreMarieBaty commented Dec 22, 2023

In src/harness/harness.c around line 182 after

    char* root_dir = getenv("DETHRACE_ROOT_DIR");
    if (root_dir != NULL) {
        LOG_INFO("DETHRACE_ROOT_DIR is set to '%s'", root_dir);
    } else {
        root_dir = OS_Dirname(argv[0]);
    }

I had to add this for macOS app bundle and Windows console support

    char* root_dir = getenv("DETHRACE_ROOT_DIR");
    if (root_dir != NULL) {
        LOG_INFO("DETHRACE_ROOT_DIR is set to '%s'", root_dir);
    } else {
        root_dir = OS_Dirname(argv[0]);
#ifdef __APPLE__
        strcat (root_dir, "/../Resources"); // Pierre-Marie Baty -- macOS .app fix
#endif /* __APPLE__ */
        if (root_dir[0] == 0)
            strcpy(root_dir, "."); // Pierre-Marie Baty -- consistency check (also Win32 fix)
    }

Basically calling chdir("") on Win32 raises an errno (which looks legit to me, what's intriguing here is that it swallows it on POSIX platforms).

@madebr
Copy link
Collaborator Author

madebr commented Jan 6, 2024

The original issue is about Macos finder running applications from / instead of the directory containing the executable.

You're using a "macosx bundle", which our cmake script does not support at all.
Somebody with an app should modify cmake + sources to add that.
CMake has MACOSX_BUNDLE.

A complication with macosx bundles is that for legal reasons, we cannot bundle game resources with an app bundle.

@PierreMarieBaty
Copy link

PierreMarieBaty commented Jan 6, 2024 via email

@madebr
Copy link
Collaborator Author

madebr commented Jan 6, 2024

No need to say sorry.
If somebody with a mac and knowledge of CMake comes along, (s)he's free to add this support.

@dethrace-labs
Copy link
Owner

Fixed by #381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants