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

Allow macOS and Linux to find files in the executable directory #493

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

Pedro-Beirao
Copy link
Contributor

Ive been meaning to make this PR for like a year :P

This is most useful for finding dsda-doom.wad. When installing/updating, you would need to copy dsda-doom.wad to some folder that dsda searched (~/.dsda-doom for example). This sucked, so adding the executable directory to the search path is pretty helpful.

Will create merge conflicts in PR #491

@@ -236,7 +236,12 @@ void I_SwitchToWindow(HWND hwnd)
}
}

const char *I_DoomExeDir(void)
const char *I_DoomDir(void)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we rather call this I_ConfigDir?

Copy link
Contributor Author

@Pedro-Beirao Pedro-Beirao May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally going to name it that, but opted with DoomDir since that folder hosts more than just the config file.
Made a new commit that changes the name

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, maybe I_DataDir? It's maybe too generic, plus confusing since dsda-doom has a "data dir" as well that's one level below that. Any other ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like I_ConfigDir.
Its pretty clear what it represents, so no one will be confused.

Z_Free(base);
base = (char*)Z_Malloc(1024);
if (!M_getcwd(base, 1024) || !M_WriteAccess(base))
strcpy(base, current_dir_dummy);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just do strcpy(base, ".");? Does this dummy variable need to persist for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No there is no reason it needs to persist. I simply copied over the code from the Windows function, didnt even try to understand it.
Made a new commit.

Copy link
Owner

@kraflab kraflab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@kraflab kraflab merged commit 83fc32a into kraflab:master Jun 14, 2024
3 of 4 checks passed
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 this pull request may close these issues.

2 participants