avatar

579

Try to improve the USB portable support by rewriting all the config values with paths to point to the USB drive when '--usb' is passed.

by mrs, 27 Jul, 2008 11:18 PM
573 579  
8181   private RuntimeInfo _rti;
8282   private static final int HOURS_IN_DAY = 24;
8383   private static final int MINUTES_IN_HOUR = 60;
84   private static boolean sUSB = false;
8485 
8586   /**
8687    * @brief Try to guarantee a directory for saving 'cached copies'
------
165166     Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
166167 
167168     JConfig.loadDisplayConfig(urlCL, screensize.width, screensize.height);
169     if(sUSB) JConfig.fixupPaths();
168170 
169171     String aucSave = makeSaveDirectory(JConfig.queryConfiguration("auctions.savepath"));
170172     if(aucSave != null) {
------
218220       return true;
219221     } else if (arg.startsWith("--usb")) {
220222       JConfig.setHome(System.getProperty("user.dir"));
223       sUSB = true;
221224     }
222225     return false;
223226   }
564 579  
8686     return mScripting;
8787   }
8888 
89   public static void fixupPaths() {
90     String[][] s = { { "auctions.savepath", "/auctionsave" },
91         { "platform.path", "/platform" },
92         {  "savefile", "/auctions.xml" },
93         {  "search.savefile", "/searches.xml" } };
94     for(String[] pair : s) {
95       JConfig.setConfiguration(pair[0], getHomeDirectory("jbidwatcher") + pair[1]);
96     }
97   }
98 
8999   public interface ConfigListener {
90100     void updateConfiguration();
91101   }