Ignore:
Timestamp:
11/19/13 12:01:52 (11 years ago)
Author:
jts21
Message:

New copy/paste handling, add pdfImporter, add dictionary and documentation to resources, other small changes

File:
1 edited

Legend:

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

    r490 r504  
    7474        static {
    7575                String expeditee_home = System.getProperty("expeditee.home");
    76 
    7776                if (expeditee_home != null) {
    78                     FrameIO.changeParentFolder(expeditee_home + File.separator);
    79                 }
    80                 else {
    81                     String jarPath = getJarLocation();
    82 
    83                     if (jarPath != null){
    84                         FrameIO.changeParentFolder(jarPath);
    85                     }
    86                     else {
    87 
    88                         FrameIO.changeParentFolder("." + File.separator + "expeditee"
    89                                                    + File.separator);
    90                     }
    91                 }
    92 
     77            FrameIO.changeParentFolder(expeditee_home + File.separator);
     78        } else {
     79                FrameIO.changeParentFolder(getSaveLocation());
     80        }
     81         
    9382                UserSettings.FrameDirs.add(FrameIO.FRAME_PATH);
    9483                UserSettings.FrameDirs.add(FrameIO.PUBLIC_PATH);
     
    10089
    10190        /**
    102          * Find where abouts the Jar is located that is running expeditee. The
    103          * reason for this was so that the framesets could be stored in the same
    104          * location as the jar file for now. Using the current directory fails to
    105          * achieve this as the current directory not the same as the directory the
    106          * jar is stored in if the user double clicks on the jar file in Linux or
    107          * runs the jar from the command line from another directory.
    108          *
    109          * @return the full path location of the Jar
     91         * Find the appropriate directory to store application settings in for
     92         * the current OS.
     93         * This has only been tested on Linux so far, so if it doesn't work it
     94         * may need to be modified or reverted. Should return:
     95         *      Linux: ~/.expeditee
     96         *      Windows: %appdata%\.expeditee
     97         *      Mac: ~/Library/Application\ Support/.expeditee
     98         * @return the path to store expeditee's settings
    11099         */
    111         public static String getJarLocation() {
    112                 // Get a File object for the package
    113                 File directory = null;
    114 
    115                 ClassLoader cld = Thread.currentThread().getContextClassLoader();
    116                 URL resource = cld.getResource("org");
    117                 directory = new File(resource.getFile());
    118 
    119                 int splitPoint = directory.getPath().indexOf('!');
    120                 if (splitPoint > 0) {
    121                         String jarName = directory.getPath().substring("file:".length(),
    122                                         splitPoint);
    123                         // Windows HACK
    124                         if (jarName.indexOf(":") >= 0)
    125                                 jarName = jarName.substring(1);
    126 
    127                         if (jarName.indexOf("%20") > 0) {
    128                                 jarName = jarName.replace("%20", " ");
    129                         }
    130 
    131                         int lastFileSeparator = jarName.lastIndexOf(File.separator);
    132                        
    133                         DisplayIO.TITLE = jarName.substring(lastFileSeparator + 1, jarName.length() - 4);
    134                        
    135                         return jarName.substring(0, lastFileSeparator + 1);
     100        public static String getSaveLocation() {
     101                String OS=System.getProperty("os.name").toLowerCase();
     102                if(OS.indexOf("win")>0) {                       //windoze
     103                        return System.getenv("APPDATA")+File.separator+".expeditee"+File.separator;
     104                } else if(OS.indexOf("mac")>0) {        //mac
     105                        return System.getProperty("user.home")+File.separator+"Library"+File.separator+"Application Support"+File.separator+".expeditee"+File.separator;
     106                } else {                                                        //linux or other
     107                        return System.getProperty("user.home")+File.separator+".expeditee"+File.separator;
    136108                }
    137                 return null;
    138109        }
    139110}
Note: See TracChangeset for help on using the changeset viewer.