Changeset 9209


Ignore:
Timestamp:
2005-02-28T14:50:03+13:00 (19 years ago)
Author:
mdewsnip
Message:

Some tidy ups to the applet code.

File:
1 edited

Legend:

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

    r9202 r9209  
    137137    static public boolean delete(File file)
    138138    {
     139    // Nothing to do if it doesn't exist
     140    if (!file.exists()) {
     141        return true;
     142    }
     143
    139144    // If file is a directory, we have to recursively delete its contents first
    140145    if (file.isDirectory()) {
     
    558563
    559564        if (zipentry.isDirectory()) {
    560             // Create named directory
    561             boolean success = (new File(zentryname)).mkdir();
    562             if (!success) {
    563             System.err.println("Error: unable to create directory '"+zentryname+"'");
     565            // Create named directory, if it doesn't already exist
     566            File zip_entry_file = new File(zentryname);
     567            if (!zip_entry_file.exists() && !zip_entry_file.mkdirs()) {
     568            System.err.println("Error: unable to create directory " + zip_entry_file);
    564569            }
    565570        }
     
    843848
    844849        if (zipentry.isDirectory()) {
    845             if(!file.exists()) {
    846             // Create named directory, if it doesn't already exist.
    847             boolean success = (file.mkdir());
    848             if (!success) {
    849                 System.err.println("Error: unable to create directory '"+zentryname+"'");
    850             }
     850            // Create named directory, if it doesn't already exist
     851            if (!file.exists() && !file.mkdirs()) {
     852            System.err.println("Error: unable to create directory " + file);
    851853            }
    852854        }
Note: See TracChangeset for help on using the changeset viewer.