Changeset 10207


Ignore:
Timestamp:
2005-07-05T12:21:25+12:00 (19 years ago)
Author:
davidb
Message:

Minor changes to zipping and unzipping files to be compatible with Windows version of
applet

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/GathererApplet.java

    r10010 r10207  
    109109        File gli_user_directory = Utility.setGLIUserFolder(windows_home);
    110110    if (!gli_user_directory.exists()) {
    111         gli_user_directory.mkdirs();
     111        if (!gli_user_directory.mkdirs()) {
     112            System.err.println("Warning: Unable to make directory: " + gli_user_directory.toString());
     113        }
    112114    }
    113115
     
    165167        else {
    166168        // Prepare an empty collect dir for general use
    167         col_dir.mkdir();
     169        if (!col_dir.mkdir()) {
     170            System.err.println("Warning: Unable to make directory: " + col_dir.toString());
     171        }
    168172        }
    169173        }
     
    172176        File tmp_dir = new File(Utility.TMP_DIR);
    173177        if (!tmp_dir.exists()) {
    174             tmp_dir.mkdir();
     178            if (!tmp_dir.mkdir()) {
     179        System.err.println("Warning: Unable to make directory: " + tmp_dir.toString());
     180        }
    175181
    176182        String username = System.getProperty("user.name");
     
    178184        File user_tmp_dir = new File(Utility.TMP_DIR + File.separator + username);
    179185        if (!user_tmp_dir.exists()) {
    180             user_tmp_dir.mkdir();
     186            if (!user_tmp_dir.mkdir()) {
     187            System.err.println("Warning: Unable to make directory: " + user_tmp_dir.toString());
     188            }
    181189        }
    182190        }
  • trunk/gli/src/org/greenstone/gatherer/util/Unzip.java

    r9314 r10207  
    7070
    7171    String gsdl_home = args[0];
     72
     73    if (!gsdl_home.endsWith(File.separator)) {
     74        gsdl_home += File.separator;
     75    }
     76
    7277    String col_dir = gsdl_home + "collect" + File.separator;
    7378
     79    String zip_fname = args[1];
     80
    7481    try {
    75         zipFile = new ZipFile(args[1]);
     82        zipFile = new ZipFile(zip_fname);
    7683
    7784        entries = zipFile.entries();
     
    102109        zipFile.close();
    103110    }
     111    catch (ZipException error) {
     112        System.err.println("Error: Unable to open '"+zip_fname+"'");
     113        System.err.println("This maybe caused by the zip file being empty.");
     114        error.printStackTrace();
     115    }
     116
    104117    catch (IOException ioe) {
    105         System.err.println("Unhandled exception on " + args[1]);
     118        System.err.println("Unhandled exception on " + gsdl_home + " " + zip_fname);
    106119        ioe.printStackTrace();
    107120        return;
    108121    }
     122
     123    catch (Exception error) {
     124        error.printStackTrace();
     125    }
    109126    }
    110127}
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r10013 r10207  
    689689    int prefix_strip = col_dir.length();
    690690    boolean encountered_file = false;
    691 
     691   
    692692    String zip_fname = col_dir + col_name + ".zip";
    693693    String zip_dir_or_file = col_dir + col_name + File.separator + dir_or_file;
     
    751751    try {
    752752        File cfile = new File(zip_fname);
     753        System.err.println("**** zip fname = " + cfile.toString());
     754
    753755        ZipFile zipfile = new ZipFile(cfile, zip_mode);
    754756       
Note: See TracChangeset for help on using the changeset viewer.