Skip to content

Commit 3fdbf4f

Browse files
tryfix abspath c func with "" on windows
1 parent f6cb684 commit 3fdbf4f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/init.c

+8
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,14 @@ static char *abspath(const char *in, int nprefix)
575575
}
576576
}
577577
#else
578+
// GetFullPathName intentionally errors if given an empty string so manually insert `.`
579+
if (strlen(in) - nprefix == 0) {
580+
size_t path_size = JL_PATH_MAX;
581+
char *in2 = (char*)malloc_s(JL_PATH_MAX);
582+
memcpy(in2, in, nprefix);
583+
in2[nprefix+1] = '.';
584+
in = in2;
585+
}
578586
DWORD n = GetFullPathName(in + nprefix, 0, NULL, NULL);
579587
if (n <= 0) {
580588
jl_error("fatal error: jl_options.image_file path too long or GetFullPathName failed");

0 commit comments

Comments
 (0)