Changeset 9202 for trunk/gli/src/org/greenstone/gatherer/util
- Timestamp:
- 2005-02-28T10:29:08+13:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/Unzip.java
r7820 r9202 103 103 } 104 104 catch (IOException ioe) { 105 System.err.println("Unhandled exception :");105 System.err.println("Unhandled exception on " + args[1]); 106 106 ioe.printStackTrace(); 107 107 return; -
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r9195 r9202 71 71 static final public int BUFFER_SIZE = FACTOR * 1024; 72 72 /** Definition of an important directory name, in this case the base dir, or the working directory of the Gatherer. */ 73 /** The regular expression that marks if we only want doc.xml files. Will this work in Windows?? --Matthew */74 static final public String METADATA_ONLY_EXPR = "\".*" + File.separator + "doc\\.xml\"";75 73 76 74 static public String BASE_DIR = System.getProperty("user.dir") + File.separator; … … 627 625 if((reject_expr != "") && (file_path.matches(reject_expr))) { 628 626 // matches reject expression 629 DebugStream.println("File \'" + file_path + "\' matches the reject expression \'" + reject_expr + "\'");627 //DebugStream.println("File \'" + file_path + "\' matches the reject expression \'" + reject_expr + "\'"); 630 628 return encountered_file; 631 629 } … … 633 631 if ((accept_expr != "") && (!file_path.matches(accept_expr))) { 634 632 // does not match accept expression 635 DebugStream.println("File \'" + file_path + "\' doesn't match accept expression \'" + accept_expr + "\'");633 //DebugStream.println("File \'" + file_path + "\' doesn't match accept expression \'" + accept_expr + "\'"); 636 634 return encountered_file; 637 635 } … … 639 637 //Special case: we only want the metadata. Parse the xml files. 640 638 if(accept_expr.compareTo(".*doc.xml") == 0) { 641 System.err.println("Only want to get metadata"); //debug639 DebugStream.println("Only want to get metadata"); 642 640 Document old_document = XMLTools.parseXMLFile(new File(file_path)); 643 641 NodeList content = old_document.getElementsByTagName("Content"); … … 719 717 static protected boolean dirFunc (ZipOutputStream zos, String dir_name, int prefix_strip, GShell source, boolean encountered_file, String accept_expr, String reject_expr) 720 718 { 721 /*722 if (reject_expr != "" && (dir_name.matches(reject_expr))) {723 // matches reject expression724 System.err.println("matches reject expression");725 return encountered_file;726 }727 728 if ((accept_expr != "") && (!dir_name.matches(accept_expr))) {729 // does not match accept expression730 System.err.println("doesn't match accept expression");731 return encountered_file;732 }733 */734 735 719 File dirObj = new File(dir_name); 736 720 … … 859 843 860 844 if (zipentry.isDirectory()) { 861 // Create named directory 862 boolean success = (new File(zentryname)).mkdir(); 863 if (!success) { 864 System.err.println("Error: unable to create directory '"+zentryname+"'"); 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 } 865 851 } 866 852 } … … 894 880 catch (ZipException error) { 895 881 System.err.println("Error: Unable to open '"+zip_fname+"'"); 882 System.err.println("This maybe caused by the zip file being empty."); 896 883 DebugStream.printStackTrace(error); 897 884 }
Note:
See TracChangeset
for help on using the changeset viewer.