summaryrefslogtreecommitdiff
path: root/lib/src/winp.patch
blob: c3828306e8ee4c598c8684521c9f6f489f1d031d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff -ur winp-winp-1.17/src/main/java/org/jvnet/winp/Native.java winp-1.17-patched/src/main/java/org/jvnet/winp/Native.java
--- winp-winp-1.17/src/main/java/org/jvnet/winp/Native.java	2013-01-03 09:26:13.000000000 +0400
+++ winp-1.17-patched/src/main/java/org/jvnet/winp/Native.java	2013-02-25 16:23:24.000000000 +0400
@@ -47,6 +47,7 @@
     private static final Logger LOGGER = Logger.getLogger(Native.class.getName());
     // system property holding the preferred folder for copying the dll file to.
     private static final String DLL_TARGET = "winp.folder.preferred";
+    private static final String UNPACK_DLL_TO_PARENT_DIR = "winp.unpack.dll.to.parent.dir";
 
     static {
         load();
@@ -61,7 +62,12 @@
         final URL res = Native.class.getClassLoader().getResource(dllName+".dll");
         if(res!=null) {
             String url = res.toExternalForm();
-            if(url.startsWith("jar:") || url.startsWith("wsjar:")) {
+
+          //patched by JetBrains: do not try to unpack the dll file to the directory containing the jar file by default.
+          // It can fail because the process has no rights to write to that directory and also pollutes the project directories if the jar is used in development mode.
+          boolean unpackToParentDir = Boolean.parseBoolean(System.getProperty(UNPACK_DLL_TO_PARENT_DIR));
+
+          if(unpackToParentDir && (url.startsWith("jar:") || url.startsWith("wsjar:"))) {
                 int idx = url.lastIndexOf('!');
                 String filePortion = url.substring(url.indexOf(':')+1,idx);
                 while(filePortion.startsWith("/"))