diff --git a/src/init.c b/src/init.c index fef3e73bd2d06a..39b6e61edf6e4b 100644 --- a/src/init.c +++ b/src/init.c @@ -575,6 +575,14 @@ static char *abspath(const char *in, int nprefix) } } #else + // GetFullPathName intentionally errors if given an empty string so manually insert `.` to invoke cwd + 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");