Package: josm / 0.0.svn11427+dfsg-1~bpo8+1

06-move_data_out_of_jar.patch Patch series | download
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Description: Move sharable data out of josm.jar.
Author: David Paleino <dapal@debian.org>
Author: Paul Hartmann <phaaurlt@googlemail.com>
Bug-Debian: https://bugs.debian.org/698608
Forwarded: not-needed

--- a/build.xml
+++ b/build.xml
@@ -155,9 +155,9 @@ Debian-Release: ${debian.version}
                 <attribute name="Debian-Release" value="${debian.version}"/>
                 <attribute name="Class-Path" value="${classpathprop}"/>
             </manifest>
-            <zipfileset dir="images" prefix="images"/>
-            <zipfileset dir="data" prefix="data"/>
-            <zipfileset dir="styles" prefix="styles"/>
+            <!--<zipfileset dir="images" prefix="images"/>-->
+            <!--<zipfileset dir="data" prefix="data"/>-->
+            <!--<zipfileset dir="styles" prefix="styles"/>-->
         </jar>
     </target>
     <!-- Mac OS X target -->
--- a/src/org/openstreetmap/josm/tools/I18n.java
+++ b/src/org/openstreetmap/josm/tools/I18n.java
@@ -10,6 +10,7 @@ import java.io.InputStream;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.net.URL;
+import java.net.MalformedURLException;
 import java.nio.charset.StandardCharsets;
 import java.text.MessageFormat;
 import java.util.ArrayList;
@@ -362,7 +363,11 @@ public final class I18n {
     }
 
     private static URL getTranslationFile(String lang) {
-        return Main.class.getResource("/data/"+lang.replace('@', '-')+".lang");
+        try {
+            return new URL("file:///usr/share/josm/data/"+lang.replace('@', '-')+".lang");
+        } catch (MalformedURLException ex) {
+            return null;
+        }
     }
 
     /**
--- a/src/org/openstreetmap/josm/io/CachedFile.java
+++ b/src/org/openstreetmap/josm/io/CachedFile.java
@@ -207,11 +207,17 @@ public class CachedFile implements Close
         File file = getFile();
         if (file == null) {
             if (name.startsWith("resource://")) {
-                InputStream is = getClass().getResourceAsStream(
-                        name.substring("resource:/".length()));
-                if (is == null)
-                    throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
-                return is;
+                String path = name.substring("resource://".length());
+                File fileRes = new File("/usr/share/josm/" + path);
+                if (fileRes.exists()) {
+                    file = fileRes;
+                } else {
+                    InputStream is = getClass().getResourceAsStream(
+                            name.substring("resource:/".length()));
+                    if (is == null)
+                        throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
+                    return is;
+                }
             } else {
                 throw new IOException("No file found for: "+name);
             }