[sikuli] 54/385: to support libs export when running from an IDE with the basic project modules or using Maven from command line

Gilles Filippini pini at moszumanska.debian.org
Sun Jun 29 19:25:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

pini pushed a commit to tag upstream/1.1.0_beta1
in repository sikuli.

commit 883364f6b13e49dbd58ef8e63125838960d6326a
Author: Raimund Hocke <rmhdevelop at me.com>
Date:   Sun Dec 29 12:39:52 2013 +0100

    to support libs export when running from an IDE with the basic project modules or using Maven from command line
---
 .../src/main/java/org/sikuli/basics/ResourceLoader.java  | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/Basics/src/main/java/org/sikuli/basics/ResourceLoader.java b/Basics/src/main/java/org/sikuli/basics/ResourceLoader.java
index fd9faba..4bb1405 100755
--- a/Basics/src/main/java/org/sikuli/basics/ResourceLoader.java
+++ b/Basics/src/main/java/org/sikuli/basics/ResourceLoader.java
@@ -24,6 +24,7 @@ import java.util.StringTokenizer;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import org.sikuli.natives.RunNatives;
+import org.sikuli.libs.RunLibs;
 
 public class ResourceLoader implements IResourceLoader {
 
@@ -52,6 +53,7 @@ public class ResourceLoader implements IResourceLoader {
   private String jarParentPath = null;
   private String jarPath = null;
   private URL jarURL = null;
+  private URL libsURL = null;
   private String fileList = "/filelist.txt";
   private static final String sikhomeEnv = System.getenv("SIKULIX_HOME");
   private static final String sikhomeProp = System.getProperty("sikuli.Home");
@@ -124,6 +126,11 @@ public class ResourceLoader implements IResourceLoader {
       log(-1, "Fatal Error 101: Not possible to access the jar files!");
       SikuliX.terminate(101);
     }
+    
+    CodeSource cs = RunLibs.class.getProtectionDomain().getCodeSource();
+    if (codeSrc != null && codeSrc.getLocation() != null) {
+      libsURL = cs.getLocation();
+    }
     regMap.put("EnvPath", new String[]{"HKEY_CURRENT_USER\\Environment", "PATH", "REG_EXPAND_SZ"});
   }
 
@@ -158,18 +165,19 @@ public class ResourceLoader implements IResourceLoader {
    */
   @Override
   public void check(String what) {
+    mem = "check";
+
     if (System.getProperty("sikuli.DoNotExport") == null && !isFatJar()) {
       if (!jarPath.contains("Natives") && !Settings.isMac()) {
         RunSetup.popError("Terminating: The jar in use was not built with setup!\n" + jarPath);
         System.exit(1);
       } else {
-//        jarPath = jarPath.replace("Natives", "Libs");
-        log(-1, "The jar in use was not built with setup!\nRunning in Netbeans? trying:\n" + jarPath);
-//        System.exit(1);
+        jarURL = libsURL;
+        jarPath = jarPath.replace("Natives", "Libs");
+        log(-1, "The jar in use was not built with setup!\nAre we running in some IDE or from local Maven repository? trying:\n" + jarPath);
       }
     }
 
-    mem = "check";
     if (!what.equals(Settings.SIKULI_LIB)) {
       log(-1, "Currently only Sikuli libs supported!");
       return;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git



More information about the pkg-java-commits mailing list