IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25665


Ignore:
Timestamp:
Sep 29, 2009, 11:40:54 AM (17 years ago)
Author:
bills
Message:

when adding, if product directory exists require that it be empty.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStoreServer/scripts/dsprodtool

    r25664 r25665  
    192192
    193193    # set up the product directory
     194    # if there is an old index file delete it
     195    if (-e $index_script_name ) {
     196        if (!unlink($index_script_name)) {
     197            die("failed trying to remove old $index_script_name");
     198        }
     199    }
    194200    if (! -e $product_dir) {
    195201        $we_created_dir = 1;
     
    197203            die("failed trying to make product directory $product_dir");
    198204        }
    199     }
    200     if (-e $index_script_name ) {
    201         if (!unlink($index_script_name)) {
    202             die("failed trying to remove old $index_script_name");
    203         }
    204     }
     205    } else {
     206        # directory alrady exists make sure that it's empty
     207        my @dirlist = glob("$product_dir/*");
     208        die ("existing product directory $product_dir is not empty") if scalar @dirlist;
     209    }
     210
    205211    if (!copy($root_index_script, $index_script_name)) {
    206212        print STDERR "failed trying to copy($root_index_script, $index_script_name)";
Note: See TracChangeset for help on using the changeset viewer.