Skip leading path separators in the relative JRE path.
This commit is contained in:
parent
5dcdfa7195
commit
d32bd86a6b
11
src/head.c
11
src/head.c
@ -244,6 +244,15 @@ static wchar_t * trim_trailing_separator(wchar_t *const path)
|
||||
return path;
|
||||
}
|
||||
|
||||
static const wchar_t *skip_leading_separator(const wchar_t *path)
|
||||
{
|
||||
if (NOT_EMPTY(path))
|
||||
{
|
||||
for (; (*path) && ((*path == L'\\') || (*path == L'/')); ++path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static BOOL file_exists(const wchar_t *const filename) {
|
||||
struct _stat buffer;
|
||||
if (_wstat(filename, &buffer) == 0)
|
||||
@ -1104,7 +1113,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
||||
}
|
||||
#else
|
||||
jre_relative_path = load_string(hInstance, ID_STR_JREPATH);
|
||||
if (!(java_runtime_path = awprintf(L"%ls\\%ls", executable_directory, AVAILABLE(jre_relative_path) ? jre_relative_path: JRE_RELATIVE_PATH_DEFAULT)))
|
||||
if (!(java_runtime_path = awprintf(L"%ls\\%ls", executable_directory, AVAILABLE(jre_relative_path) ? skip_leading_separator(jre_relative_path) : JRE_RELATIVE_PATH_DEFAULT)))
|
||||
{
|
||||
show_message(hwnd, MB_ICONERROR | MB_TOPMOST, APP_HEADING, L"The path of the Java runtime could not be determined!");
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user