Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rel2abs java.library.path.N #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion WinRun4J/src/java/VM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,34 @@ void VM::ExtractSpecificVMArgs(dictionary* ini, TCHAR** args, UINT& count)
UINT libPathsCount = 0;
INI::GetNumberedKeysFromIni(ini, JAVA_LIBRARY_PATH, libPaths, libPathsCount);
if(libPathsCount > 0) {

//toPeter: Sorry I am repeating the same code, i really hate it but I cannot afford a refactoring right now, duplicit to #83 row
// If the working.dir is not specified then we assume the java.library.path location is relative to the module dir
char defWorkingDir[MAX_PATH];
char* workingDir = iniparser_getstr(ini, WORKING_DIR);
if(!workingDir) {
GetCurrentDirectory(MAX_PATH, defWorkingDir);
SetCurrentDirectory(iniparser_getstr(ini, INI_DIR));
}

TCHAR libPathArg[4096];
libPathArg[0] = 0;
strcat(libPathArg, "-Djava.library.path=");
for(int i =0 ; i < libPathsCount; i++) {
strcat(libPathArg, libPaths[i]);

//rel2abs
char fullpath[MAX_PATH];
GetFullPathName(libPaths[i], MAX_PATH, fullpath, NULL);
strcat(libPathArg, fullpath);
strcat(libPathArg, ";");
}
args[count++] = strdup(libPathArg);

//toPeter: Sorry I am repeating the same code, i really hate it but I cannot afford a refactoring right now, duplicit to #119 row
// Reset working dir if set
if(!workingDir) {
SetCurrentDirectory(defWorkingDir);
}
}
}

Expand Down