exe launchers: fixed the case when folder jre\bin was locked.

It prevented updating the folder during patches.
This commit is contained in:
Vladimir.Orlov
2017-02-20 16:18:19 +03:00
parent 909f89ab6e
commit 11961c19db
3 changed files with 4 additions and 1 deletions
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -532,6 +532,7 @@ bool LoadJVMLibrary()
{
std::string dllName(jvmPath);
std::string binDir = dllName + "\\bin";
TCHAR currentDir[MAX_PATH];
std::string serverDllName = binDir + "\\server\\jvm.dll";
std::string clientDllName = binDir + "\\client\\jvm.dll";
if ((bServerJVM && FileExists(serverDllName)) || !FileExists(clientDllName))
@@ -544,12 +545,14 @@ bool LoadJVMLibrary()
}
// ensure we can find msvcr100.dll which is located in jre/bin directory; jvm.dll depends on it.
GetCurrentDirectory(sizeof(currentDir),currentDir);
SetCurrentDirectoryA(binDir.c_str());
hJVM = LoadLibraryA(dllName.c_str());
if (hJVM)
{
pCreateJavaVM = (JNI_createJavaVM) GetProcAddress(hJVM, "JNI_CreateJavaVM");
}
SetCurrentDirectory(currentDir);
if (!pCreateJavaVM)
{
std::string jvmError = "Failed to load JVM DLL ";