Changeset 781


Ignore:
Timestamp:
01/29/14 12:22:33 (10 years ago)
Author:
jts21
Message:

Move resource extraction out of CreateDefaultProfile, since resources need to be extracted prior to frame loading in order to ensure custom fonts are loaded

Location:
trunk/src/org/expeditee/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Browser.java

    r777 r781  
    225225                String userName = UserSettings.ProfileName.get();
    226226                //UserSettings.UserName.set(UserSettings.ProfileName.get());
     227               
     228                // Load documentation and start pages
     229                FrameUtils.extractResources(false);
     230                // Load fonts before loading any frames so the items on the frames will be able to access their fonts
     231                Text.InitFonts();
    227232
    228233                Frame profile = loadProfile(userName);
     
    283288                       
    284289                        Settings.Init();
    285                        
    286                         Text.InitFonts();
    287290
    288291                        DisplayIO.Init(this);
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r778 r781  
    14991499        yPos = 100;
    15001500
    1501         // Load documentation and start pages
    1502         extractResources();
    1503 
    15041501        // Add documentation links
    15051502        File helpDirectory = new File(FrameIO.HELP_PATH);
     
    17231720     * Extracts files/folders from the assets/resources folder directly into
    17241721     * ${PARENT_FOLDER} (~/.expeditee)
     1722     *
     1723     * @param force if true, resources will be extracted even if they have already been extracted before
    17251724     */
    1726     private static void extractResources() {
     1725    public static void extractResources(boolean force) {
     1726        File check = new File(FrameIO.PARENT_FOLDER + ".res");
     1727        if(!force && check.exists()) {
     1728                return;
     1729        }
    17271730                System.out.println("Extracting/Installing resources:");
    17281731                try     {
     1732                        check.getParentFile().mkdirs();
     1733                check.createNewFile();
     1734               
    17291735                        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    17301736                        URL docURL = classLoader.getResource("org/expeditee/assets/resources");
     
    17471753                                        File out = new File(FrameIO.PARENT_FOLDER + ze.getName().substring(resLength));
    17481754                                        // System.out.println("Didn't crash here " + out.getPath());
    1749                                         if(out.exists()) {
    1750                                                 continue;
    1751                                         }
     1755//                                      if(out.exists()) {
     1756//                                              continue;
     1757//                                      }
    17521758                                        if(ze.isDirectory()) {
    17531759                                                // System.out.println(out.getPath() + " IS DIRECTORY");
     
    17911797                        }
    17921798                }
    1793                 catch (Exception e)
    1794                 {
     1799                catch (Exception e) {
    17951800                        e.printStackTrace();
    17961801                }
     
    18191824                System.out.println(file.getPath());
    18201825                File out = new File(FrameIO.PARENT_FOLDER + file.getPath().substring(file.getPath().indexOf(res) + resLength));
    1821                 if(out.exists()) {
    1822                         continue;
    1823                 }
     1826//              if(out.exists()) {
     1827//                      continue;
     1828//              }
    18241829                out.getParentFile().mkdirs();
    18251830                FileOutputStream fOut = null;
Note: See TracChangeset for help on using the changeset viewer.