[sikuli] 205/385: extract Lib folder only once per session - fixed a problem when running from root folder

Gilles Filippini pini at moszumanska.debian.org
Sun Jun 29 19:26:13 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 546ce255755a2526fee7fe4e9620bb07fd3aa425
Author: Raimund Hocke <rmhdevelop at me.com>
Date:   Tue Feb 11 16:12:59 2014 +0100

    extract Lib folder only once per session - fixed a problem when running from root folder
---
 Basics/src/main/java/org/sikuli/basics/ResourceLoader.java | 12 ++++++++----
 1 file changed, 8 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 950de8f..ffbf7fd 100755
--- a/Basics/src/main/java/org/sikuli/basics/ResourceLoader.java
+++ b/Basics/src/main/java/org/sikuli/basics/ResourceLoader.java
@@ -71,7 +71,7 @@ public class ResourceLoader implements IResourceLoader {
   private static final String libSub = prefixSikuli + suffixLibs;
   private String userSikuli = null;
   private boolean extractingFromJar = false;
-  private boolean itIsJython = false;
+  private static boolean itIsJython = false;
   /**
    * Mac: standard place for native libs
    */
@@ -303,12 +303,15 @@ public class ResourceLoader implements IResourceLoader {
         // check the working directory and its parent
         if (libPath == null && userdir != null) {
           File wd = new File(userdir);
+          File wdpl = null;
           File wdp = new File(userdir).getParentFile();
           File wdl = new File(FileManager.slashify(wd.getAbsolutePath(), true) + libSub);
-          File wdpl = new File(FileManager.slashify(wdp.getAbsolutePath(), true) + libSub);
+          if (wdp != null) {
+              wdpl = new File(FileManager.slashify(wdp.getAbsolutePath(), true) + libSub);
+          }
           if (wdl.exists()) {
             libPath = wdl.getAbsolutePath();
-          } else if (wdpl.exists()) {
+          } else if (wdpl != null && wdpl.exists()) {
             libPath = wdpl.getAbsolutePath();
           }
           log(lvl, "Exists libs folder in working folder or its parent? %s: %s", libPath == null ? "NO" : "YES",
@@ -400,6 +403,7 @@ public class ResourceLoader implements IResourceLoader {
 
     if (itIsJython) {
       export("Lib/sikuli", libsDir.getParent());
+      itIsJython = false;
     }
 
     if (Settings.OcrDataPath == null && System.getProperty("sikuli.DoNotExport") == null) {
@@ -500,7 +504,7 @@ public class ResourceLoader implements IResourceLoader {
     URL currentURL = jarURL;
     int lenOriginalURL = currentURL.toString().length();
 //TODO special export cases from jars not on class path
-    if (res.contains("tessdata")) {
+    if (res.contains("tessdata") && tessURL != null) {
       currentURL = tessURL;
       prefix += currentURL.toString().length() - lenOriginalURL;
     }

-- 
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