Changeset 17680


Ignore:
Timestamp:
2008-11-05T12:34:35+13:00 (15 years ago)
Author:
ak19
Message:

Dr Bainbridge fixed this so that the database file txt.gz is now decompressed and converted into .ldb database file. Works on Windows but requires the help of a new perl script txtgz-to-gdbm.pl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/common-src/src/lib/gdbmclass.cpp

    r17065 r17680  
    105105      if (file_exists(txtgz_filename))
    106106      {
    107     text_t cmd = "gzip --decompress --to-stdout \"" + txtgz_filename + "\"";
    108     cmd += " | txt2db \"" + filename + "\"";
    109 
     107    //text_t cmd = "gzip --decompress --to-stdout \"" + txtgz_filename + "\"";
     108    //cmd += " | txt2db \"" + filename + "\"";
     109   
     110    text_t cmd;
     111#ifdef __WIN32__
     112    cmd = "perl -S txtgz-to-gdbm.pl \"" + txtgz_filename + "\" \"" + filename + "\"";
     113#else
     114    cmd = "perl txtgz-to-gdbm.pl \"" + txtgz_filename + "\" \"" + filename + "\"";
     115#endif
     116   
    110117    int rv = gsdl_system(cmd, true, cerr);
     118    // For some reason, launching this command with gsdl_system() still returns 1
     119    // even when it returns 0 when run from the command-line. We can check whether
     120    // we succeeded by looking at whether the output database file was created.
    111121    if (rv != 0) {
    112       cerr << "Tried to run command \""<<cmd<<"\", but it failed\n";
    113     }
     122      cerr << "\nWarning, non-zero return value on running command \""
     123           << cmd << "\": " << rv << endl;
     124      if (!file_exists(filename)) {
     125        cerr << "Tried to run command \""<<cmd<<"\", but it failed\n";
     126      }
     127    }   
    114128      }
    115129    }
Note: See TracChangeset for help on using the changeset viewer.