-
Notifications
You must be signed in to change notification settings - Fork 41
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
fix(fs.c, windows, ucrt64): fix getcwd for windows ucrt64 builds #214
fix(fs.c, windows, ucrt64): fix getcwd for windows ucrt64 builds #214
Conversation
…cwd on windows to fix compilation on msys ucrt64 Signed-off-by: NaitLee <naitlee@disroot.org>
…cwd on windows to fix compilation on msys ucrt64 Signed-off-by: NaitLee <naitlee@disroot.org>
6e6ccd6
to
fb909df
Compare
fs.c
Outdated
@@ -2197,7 +2197,7 @@ static void FS_Init_Dir (void) | |||
#else | |||
// use the working directory | |||
#ifdef WIN32 | |||
_wgetcwd(fs_basedirw, sizeof(fs_basedirw)); | |||
GetCurrentDirectoryW(sizeof(fs_basedirw), fs_basedirw); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be sizeof(fs_basedirw) / sizeof(*fs_basedirw), so that the elements, not bytes, are counted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. New commit pushed to fix this.
…/darkplaces into NaitLee/getcwd-on-windows-ucrt64
wasm error seems unrelated. As for _wgetcwd vs GetCurrentDirectoryW - I still am not convinced that was the problem, but at the same time, don't care. The winapi function name is slightly more readable than the not-really-posix name, both are proprietary, so may as well keep the winapi one you got there. |
I'm really late 🥲 With this patch, compiling darkplaces master with msys2 ucrt64 environment is back to normal.
History:
_getcwd
function used in the patch is causing segmentation fault in ucrt64 environment:Closes gitlab.com/xonotic/darkplaces#422.