Changeset 4395


Ignore:
Timestamp:
2003-05-28T14:58:07+12:00 (21 years ago)
Author:
jmt12
Message:

FileNode now check, when mapping their children, for symbolic links so as to avoid infinite copy loops. However this may cause the ugly 'Disk Not Found in Drive A:' bug to resurface. Watch this space.

File:
1 edited

Legend:

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

    r4391 r4395  
    11package org.greenstone.gatherer.file;
    22
    3 import java.io.File;
     3import java.io.*;
    44import java.util.*;
    55import javax.swing.*;
     
    249249            // Preclude the directory of any open collection
    250250            String collection_name = Gatherer.c_man.getCollection().getName();
    251             for(int j = 0; collection_name != null && files != null && j < files.length; j++) {
     251            for(int j = 0; collection_name != null && j < files.length; j++) {
    252252            if(files[j].getName().equals(collection_name)) {
    253253                // Remove the offending directory
     
    255255                collection_name = null; // Only have to do this once.
    256256            }
     257            }
     258        }
     259        // Finally remove any files whose canonical path do not match their absolute one (ie symbolic links)
     260        for(int k = files.length; k != 0; k--) {
     261            try {
     262            if(!files[k-1].getAbsolutePath().equals(files[k-1].getCanonicalPath())) {
     263                ///ystem.err.println("For file: " + files[k-1].getName());
     264                ///ystem.err.println("Absolute Path:  " + files[k-1].getAbsolutePath());
     265                ///ystem.err.println("Canonical Path: " + files[k-1].getCanonicalPath());
     266                files = ArrayTools.remove(files, (k-1));
     267            }
     268            }
     269            catch (IOException exception) {
     270            Gatherer.printStackTrace(exception);
    257271            }
    258272        }
Note: See TracChangeset for help on using the changeset viewer.