Skip to content

Commit

Permalink
tryfix abspath c func with "" on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Nov 12, 2023
1 parent f6cb684 commit 3fdbf4f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ static char *abspath(const char *in, int nprefix)
}
}
#else
// GetFullPathName intentionally errors if given an empty string so manually insert `.`
if (strlen(in) - nprefix == 0) {
size_t path_size = JL_PATH_MAX;
char *in2 = (char*)malloc_s(JL_PATH_MAX);
memcpy(in2, in, nprefix);
in2[nprefix+1] = '.';
in = in2;
}
DWORD n = GetFullPathName(in + nprefix, 0, NULL, NULL);
if (n <= 0) {
jl_error("fatal error: jl_options.image_file path too long or GetFullPathName failed");
Expand Down

0 comments on commit 3fdbf4f

Please sign in to comment.