void
Load (ChessProgramState *cps, int i)
{
- char *p, *q, buf[MSG_SIZ], command[MSG_SIZ], buf2[MSG_SIZ];
+ char *p, *q, buf[MSG_SIZ], command[MSG_SIZ], buf2[MSG_SIZ], buf3[MSG_SIZ], jar;
if(engineLine && engineLine[0]) { // an engine was selected from the combo box
snprintf(buf, MSG_SIZ, "-fcp %s", engineLine);
SwapEngines(i); // kludge to parse -f* / -first* like it is -s* / -second*
p[-1] = SLASH;
if(SLASH == '/' && p - engineName > 1) *(p -= 2) = '.'; // for XBoard use ./exeName as command after split!
} else { ASSIGN(appData.directory[i], "."); }
+ jar = (strstr(p, ".jar") == p + strlen(p) - 4);
if(params[0]) {
if(strchr(p, ' ') && !strchr(p, '"')) snprintf(buf2, MSG_SIZ, "\"%s\"", p), p = buf2; // quote if it contains spaces
snprintf(command, MSG_SIZ, "%s %s", p, params);
p = command;
}
+ if(jar) { snprintf(buf3, MSG_SIZ, "java -jar %s", p); p = buf3; }
ASSIGN(appData.chessProgram[i], p);
appData.isUCI[i] = isUCI;
appData.protocolVersion[i] = v1 ? 1 : PROTOVER;
if(j == -2) {\r
char filter[] =\r
"All files\0*.*\0Game files\0*.pgn;*.gam\0Position files\0*.fen;*.epd;*.pos\0"\r
- "EXE files\0*.exe\0Tournament files (*.trn)\0*.trn\0"\r
+ "EXE files\0*.exe;*.jar\0Tournament files (*.trn)\0*.trn\0"\r
"BIN Files\0*.bin\0LOG Files\0*.log\0INI Files\0*.ini\0"\r
"Image files\0*.bmp\0\0";\r
OPENFILENAME ofn;\r
{ 0, 0, 0, NULL, NULL, NULL, NULL, Label, N_("or specify one below:") },\r
{ 0, 0, 0, NULL, (void*) &nickName, NULL, NULL, TextBox, N_("Nickname (optional):") },\r
{ 0, 0, 0, NULL, (void*) &useNick, NULL, NULL, CheckBox, N_("Use nickname in PGN tag") },\r
- { 0, 0, 32+3, NULL, (void*) &engineName, NULL, NULL, FileName, N_("Engine (*.exe):") },\r
+ { 0, 0, 32+3, NULL, (void*) &engineName, NULL, NULL, FileName, N_("Engine (.exe or .jar):") },\r
{ 0, 0, 0, NULL, (void*) ¶ms, NULL, NULL, TextBox, N_("command-line parameters:") },\r
{ 0, 0, 0, NULL, (void*) &wbOptions, NULL, NULL, TextBox, N_("Special WinBoard options:") },\r
{ 0, 0, 0, NULL, (void*) &engineDir, NULL, NULL, PathName, N_("directory:") },\r