ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/java/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
(Generate patch)

Comparing AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java (file contents):
Revision 649 by alloc, Fri Jan 25 12:25:29 2013 UTC vs.
Revision 651 by alloc, Fri Jan 25 14:03:29 2013 UTC

# Line 5 | Line 5 | import java.io.File;
5   import java.io.FileNotFoundException;
6   import java.io.IOException;
7   import java.io.PrintStream;
8 + import java.lang.reflect.InvocationTargetException;
9 + import java.lang.reflect.Method;
10 + import java.net.MalformedURLException;
11   import java.net.URL;
12 + import java.net.URLClassLoader;
13   import java.util.ResourceBundle;
14  
15   import javax.imageio.ImageIO;
# Line 35 | Line 39 | import org.simplericity.macify.eawt.Defa
39   */
40   public class AEInstaller2 {
41  
42 <        private static ResourceBundle imagesBundle = ResourceBundle
43 <                        .getBundle("net.oni2.aeinstaller.Images");
44 <        private static ResourceBundle basicBundle = ResourceBundle
41 <                        .getBundle("net.oni2.aeinstaller.AEInstaller");
42 <        private static ResourceBundle globalBundle = ResourceBundle
43 <                        .getBundle("net.oni2.aeinstaller.localization.Global");
42 >        private static ResourceBundle imagesBundle;
43 >        private static ResourceBundle basicBundle;
44 >        private static ResourceBundle globalBundle;
45  
46          private static Application app = null;
47  
# Line 60 | Line 61 | public class AEInstaller2 {
61                  }
62          }
63  
64 +        private static void addClassPath(File dir) {
65 +                try {
66 +                        URL u = dir.toURI().toURL();
67 +                        URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader
68 +                                        .getSystemClassLoader();
69 +                        Class<URLClassLoader> urlClass = URLClassLoader.class;
70 +                        Method method = urlClass.getDeclaredMethod("addURL",
71 +                                        new Class[] { URL.class });
72 +                        method.setAccessible(true);
73 +                        method.invoke(urlClassLoader, new Object[] { u });
74 +                } catch (MalformedURLException e) {
75 +                } catch (SecurityException e) {
76 +                } catch (NoSuchMethodException e) {
77 +                } catch (IllegalArgumentException e) {
78 +                } catch (IllegalAccessException e) {
79 +                } catch (InvocationTargetException e) {
80 +                }
81 +        }
82 +
83          /**
84           * @param args
85           *            Command line arguments
# Line 95 | Line 115 | public class AEInstaller2 {
115                  Settings.setDebug(debug);
116                  Settings.getInstance().setNoCacheUpdateMode(noCacheUpdate);
117  
118 +                File localesDir = new File(Paths.getInstallerPath(), "locales");
119 +                if (localesDir.isDirectory())
120 +                        addClassPath(localesDir);
121 +                imagesBundle = ResourceBundle.getBundle("net.oni2.aeinstaller.Images");
122 +                basicBundle = ResourceBundle
123 +                                .getBundle("net.oni2.aeinstaller.AEInstaller");
124 +                globalBundle = ResourceBundle
125 +                                .getBundle("net.oni2.aeinstaller.localization.Global");
126 +
127                  SwingJavaBuilder.getConfig().addResourceBundle(imagesBundle);
128                  SwingJavaBuilder.getConfig().addResourceBundle(basicBundle);
129                  SwingJavaBuilder.getConfig().addResourceBundle(globalBundle);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)