Changeset 618


Ignore:
Timestamp:
12/13/13 10:28:17 (11 years ago)
Author:
jts21
Message:

Renamed resources folder to assets, made a resources folder within assets folder, moved all files which get extracted from the jar into the assets/resources folder in order to simplify extraction.
TODO: Test extraction on Windows to make sure it still works
TODO: Find out what's causing the exception when loading the SimpleTestSuite frameset

Location:
trunk/src/org/expeditee
Files:
1 added
3 deleted
2 edited
3 copied
1 moved

Legend:

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

    r570 r618  
    170170            try
    171171        {
    172           URL iconURL = ClassLoader.getSystemResource("org/expeditee/resources/icons/expediteeicon128.png");
     172          URL iconURL = ClassLoader.getSystemResource("org/expeditee/assets/icons/expediteeicon128.png");
    173173          if (iconURL != null)
    174174          {
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r614 r618  
    14111411               
    14121412                // Load documentation and start pages
    1413                 extractDocumentation();
     1413                extractResources();
    14141414               
    14151415                // Add documentation links
     
    14331433                                        if (!FrameIO.isValidFramesetName(framesetName))
    14341434                                                continue;
     1435                                        System.out.println(framesetName);
    14351436                                        Frame indexFrame = FrameIO.LoadFrame(framesetName + '1');
    14361437                                        // Look through the folder for help index pages
     
    16201621       
    16211622        /**
    1622          * Loads documentation and template files from the jar or the src.
     1623         * Extracts files/folders from the assets/resources folder directly into ${PARENT_FOLDER} (~/.expeditee)
    16231624         */
    1624         private static void extractDocumentation() {
    1625                 System.out.println("docs");
     1625        private static void extractResources() {
     1626                System.out.println("resources");
    16261627                try     {
    16271628                        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    1628                         URL docURL = classLoader.getResource("org/expeditee/resources");
    1629                        
    1630                         String path;
    1631                         String classPath;
     1629                        URL docURL = classLoader.getResource("org/expeditee/assets/resources");
    16321630                       
    16331631                        // copy files from the jar file to the profile folder
     
    16361634                                JarFile jf =ju_connection.getJarFile();
    16371635                                Enumeration<JarEntry> jarEntries = jf.entries();
     1636                                String res = "org/expeditee/assets/resources/";
     1637                                int resLength = res.length();
    16381638                               
    16391639                                ZipEntry ze;
     
    16411641                                while(jarEntries.hasMoreElements()) {
    16421642                                        ze = jarEntries.nextElement();
    1643                                         if(!(ze.getName().startsWith("org/expeditee/resources/documentation") || ze.getName().startsWith("org/expeditee/resources/dict") || ze.getName().startsWith("org/expeditee/resources/framesets"))) {
     1643                                        if(!ze.getName().startsWith(res)) {
    16441644                                                continue;
    16451645                                        }
    1646                                         // NOTE: assumes HELP_PATH is "${PARENT_FOLDER}/documentation/", DICT_PATH is "${PARENT_FOLDER}/dict/"
    1647                                         File out = new File(FrameIO.PARENT_FOLDER + ze.getName().substring("org/expeditee/resources/".length()));
     1646                                        File out = new File(FrameIO.PARENT_FOLDER + ze.getName().substring(resLength));
    16481647                                        // System.out.println("Didn't crash here " + out.getPath());
    16491648                                        if(out.exists()) {
     
    16851684                                items.addAll(Arrays.asList(folder.listFiles()));
    16861685                                LinkedList<File> files = new LinkedList<File>();
     1686                                String res = "org" + File.separator + "expeditee" + File.separator + "assets" + File.separator + "resources";
     1687                                int resLength = res.length();
     1688                               
    16871689                                while (items.size() > 0) {
    16881690                                        File file = items.remove(0);
     
    16991701                                for (File file : files) {
    17001702                                        System.out.println(file.getPath());
    1701                                         if(file.getPath().contains("org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "documentation")) {
    1702                                                 path = FrameIO.HELP_PATH;
    1703                                                 classPath = "org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "documentation";
    1704                                         } else if (file.getPath().contains("org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "dict")) {
    1705                                                 path = FrameIO.DICT_PATH;
    1706                                                 classPath = "org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "dict";
    1707                                         } else if(file.getPath().contains("org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "framesets")) {
    1708                                                 path = FrameIO.FRAME_PATH;
    1709                                                 classPath = "org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "framesets";
    1710                                         } else {
    1711                                                 continue;
    1712                                         }
    1713                                         File out = new File(path + file.getPath().substring(file.getPath().indexOf(classPath) + classPath.length()));
     1703                                        File out = new File(FrameIO.PARENT_FOLDER + file.getPath().substring(file.getPath().indexOf(res) + resLength));
    17141704                                        if(out.exists()) {
    17151705                                                continue;
Note: See TracChangeset for help on using the changeset viewer.