Skip to content

Commit

Permalink
Merge pull request #366 from ashitsalesforce/master
Browse files Browse the repository at this point in the history
Fix error in the batch mode as reported in issue #365
  • Loading branch information
ashitsalesforce authored Dec 14, 2021
2 parents d51de37 + ede0a50 commit eab604d
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public static void main(String[] args) {
argNameValuePair = Controller.getArgMapFromArgArray(args);
Controller.setConfigDir(args);
setUseGMTForDateFieldValue();
if (isBatchMode()) {
ProcessRunner.runBatchMode(args);
} else if (argNameValuePair.containsKey(SWT_NATIVE_LIB_IN_JAVA_LIB_PATH)
if (argNameValuePair.containsKey(SWT_NATIVE_LIB_IN_JAVA_LIB_PATH)
&& "true".equalsIgnoreCase(argNameValuePair.get(SWT_NATIVE_LIB_IN_JAVA_LIB_PATH))){
/* Run in the UI mode, get the controller instance with batchMode == false */
try {
Expand All @@ -112,8 +110,12 @@ public static void main(String[] args) {
System.err.println("Try JRE for the supported platform in emulation mode.");
System.exit(-1);
}
Controller controller = Controller.getInstance(UI, false, args);
controller.createAndShowGUI();
if (isBatchMode()) {
ProcessRunner.runBatchMode(args);
} else {
Controller controller = Controller.getInstance(UI, false, args);
controller.createAndShowGUI();
}
} catch (ControllerInitializationException e) {
UIUtils.errorMessageBox(new Shell(new Display()), e);
}
Expand Down Expand Up @@ -238,7 +240,13 @@ private static String getSWTDir() {
if (Files.exists(Paths.get(SWTDirStr))) {
return SWTDirStr;
}


// Look in the parent directory - batch mode
SWTDirStr = buildPathStringFromOSAndArch("../swt", "", "", "");
if (Files.exists(Paths.get(SWTDirStr))) {
return SWTDirStr;
}

SWTDirStr = buildPathStringFromOSAndArch(LOCAL_SWT_DIR + "swt", "", "", "");

if (SWTDirStr == null) {
Expand All @@ -256,8 +264,8 @@ private static String getSWTJarPath() {

File dir = new File(SWTDirStr);
FileFilter fileFilter = new WildcardFileFilter(SWTJarStr);
File[] files = dir.listFiles(fileFilter);
if (files.length == 0) { // no jar file starting with swt found
File[] files = dir.listFiles(fileFilter);
if (files == null || files.length == 0) { // no jar file starting with swt found
System.err.println("Unable to find SWT jar for "
+ System.getProperty("os.name") + " : "
+ System.getProperty("os.arch"));
Expand Down

0 comments on commit eab604d

Please sign in to comment.