Changeset 8021


Ignore:
Timestamp:
2004-08-20T16:31:40+12:00 (20 years ago)
Author:
mdewsnip
Message:

Has the format of gsdlsourcefilename suddenly changed?

File:
1 edited

Legend:

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

    r7978 r8021  
    2626
    2727    // Parse the doc.xml file
     28    System.err.println("Loading doc.xml file " + doc_xml_file_path + "...");
    2829    Document document = XMLTools.parseXMLFile(this);
    2930    if (document == null) {
     
    5960            if (metadata_element_name_full.equals("gsdlsourcefilename")) {
    6061                gsdlsourcefilename_value = XMLTools.getElementTextValue(current_metadata_element);
    61                 boolean is_unix_path = gsdlsourcefilename_value.startsWith("/");
    6262
    6363                // We're only interested in the path relative to the import folder
    6464                int import_index = gsdlsourcefilename_value.indexOf("import");
    6565                if (import_index != -1) {
    66                 gsdlsourcefilename_value = gsdlsourcefilename_value.substring(import_index + "import".length() + 1);
     66                gsdlsourcefilename_value = gsdlsourcefilename_value.substring(import_index + "import".length());
     67
     68                boolean is_unix_path = gsdlsourcefilename_value.startsWith("/");
     69                gsdlsourcefilename_value = gsdlsourcefilename_value.substring(1);
     70
     71                // Make sure the path matches the OS that is running
     72                if (is_unix_path && Utility.isWindows()) {
     73                    // Convert path from Unix to Windows
     74                    gsdlsourcefilename_value = gsdlsourcefilename_value.replaceAll("/", File.separator);
     75                }
     76                if (!is_unix_path && !Utility.isWindows()) {
     77                    // Convert path from Windows to Unix
     78                    gsdlsourcefilename_value = gsdlsourcefilename_value.replaceAll("\\", File.separator);
     79                }
    6780                }
    68 
    69                 // Make sure the path matches the OS that is running
    70                 if (is_unix_path && Utility.isWindows()) {
    71                 // Convert path from Unix to Windows
    72                 gsdlsourcefilename_value = gsdlsourcefilename_value.replaceAll("/", File.separator);
     81                else {
     82                // We don't really know what is going on...
     83                System.err.println("Warning: Could not understand gsdlsourcefilename " + gsdlsourcefilename_value);
    7384                }
    74                 if (!is_unix_path && !Utility.isWindows()) {
    75                 // Convert path from Windows to Unix
    76                 gsdlsourcefilename_value = gsdlsourcefilename_value.replaceAll("\\", File.separator);
    77                 }
    78 
    79                 System.err.println("gsdlsourcefilename: " + gsdlsourcefilename_value);
    8085            }
    8186
Note: See TracChangeset for help on using the changeset viewer.