xoreos / xoreos-tools

Tools to help the development of xoreos
https://xoreos.org/
GNU General Public License v3.0
66 stars 28 forks source link

CONVERT2DA: Code and documentation mismatch for the parameters #79

Closed bmaupin closed 2 years ago

bmaupin commented 2 years ago

I'm having a few problems with the command line parameters for convert2da.

I downloaded a few versions to test with:

wget https://github.com/xoreos/xoreos-tools/releases/download/v0.0.4/xoreos-tools-0.0.4-linux64.tar.gz
tar xvf xoreos-tools-0.0.4-linux64.tar.gz

wget https://github.com/xoreos/xoreos-tools/releases/download/v0.0.5/xoreos-tools-0.0.5-linux64.tar.gz
tar xvf xoreos-tools-0.0.5-linux64.tar.gz

wget https://github.com/xoreos/xoreos-tools/releases/download/v0.0.6/xoreos-tools-0.0.6-linux64.tar.gz
tar xvf xoreos-tools-0.0.6-linux64.tar.gz

0.0.4 works as expected. Starting with 0.0.5 (including 0.0.6) I observe the following behaviour:

  1. The -o parameter doesn't work as advertised

    Here's the output of the help text:

    ./xoreos-tools-0.0.5-linux64/convert2da | grep output
     -o      --output  <file>    Write the output to this file

    Here's what happens when I try to use -o:

    $ ./xoreos-tools-0.0.5-linux64/convert2da ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da -o appearance.csv
    ERROR: Failed reading GDA file
      Because: Failed reading GFF4 file
      Because: Not a GFF4 file

    I was able to do this as a workaround:

    $ ./xoreos-tools-0.0.5-linux64/convert2da ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da > appearance.csv
  2. Related to the previous point, the man page doesn't match the help text

    Here's a snippet of the output of running convert2da without any parameters:

            --2da               Convert to ASCII 2DA (default)
            --2dab              Convert to binary 2DA
            --cvs               Convert to CSV

    But the man page instead lists -a, -b, and -c:

    $ man xoreos-tools-0.0.5-linux64/man/convert2da.1 | grep -A 8 '\-a'
      -a
      --2da
            Convert the 2DA or GDA file into an ASCII 2DA file.  This is the default mode of opera‐
            tion.
      -b
      --2dab
            Convert the 2DA or GDA file into a binary 2DA file.
      -c
      --csv

    However, these options don't work any more:

    $ ./xoreos-tools-0.0.5-linux64/convert2da -a ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da
    ERROR: Can't open file "-a"
    $ ./xoreos-tools-0.0.5-linux64/convert2da -b ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da
    ERROR: Can't open file "-b"
    $ ./xoreos-tools-0.0.5-linux64/convert2da -c ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da
    ERROR: Can't open file "-c"
  3. --cvs should be --csv?

    $ ./xoreos-tools-0.0.5-linux64/convert2da | grep -i csv
    BioWare 2DA/GDA to 2DA/CSV converter
            --cvs               Convert to CSV

Thanks!

DrMcCoy commented 2 years ago

1.

$ ./xoreos-tools-0.0.5-linux64/convert2da ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da -o appearance.csv

If you look at the help text, the usage is

convert2da [<options>] <files[...]>

I.e. the options have to come before the files to operate on. First all the options (including output format and output file), then the input file(s).

So the correct line for you would be:

$ ./xoreos-tools-0.0.5-linux64/convert2da -o appearance.csv ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da

The examples in the manpage are wrong, though. I'll fix that, thanks!


2.

Technically, the man page doesn't list -a, -b, -c instead of the long versions, but in addition. I.e. you can use either -a or --2da, both are supposed to do the same. Just like -o and --output do the same.

But you're right, the short options for --2da, --2dab and --csv got lost in a refactor, and I didn't notice or forgot to change the man page. I'll add the short options back. Thanks!


3.

Yeah, that's a typo that got fixed in 9d66762. We didn't have a release since then, so there's unfortunately no release package with the fix, so you'll have to use --cvs for now. Sorry about that.

DrMcCoy commented 2 years ago
bmaupin commented 2 years ago

I.e. the options have to come before the files to operate on. First all the options (including output format and output file), then the input file(s).

So the correct line for you would be:

$ ./xoreos-tools-0.0.5-linux64/convert2da -o appearance.csv ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da

I forgot to mention it, but I remember seeing that in the usage and I tried it but it didn't work either:

$ ./xoreos-tools-0.0.5-linux64/convert2da -o appearance.csv ~/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da
ERROR: Can't open file "/home/user/.steam/steam/steamapps/workshop/content/208580/485537937/override/appearance.2da"
DrMcCoy commented 2 years ago
$ ./xoreos-tools-0.0.5-linux64/convert2da -o foo.csv ~/projects/xoreos/data/nwn/2da/feat.2da 
$ file foo.csv 
foo.csv: ASCII text, with very long lines (546)

Works fine here. Are you sure you have the correct path there?

bmaupin commented 2 years ago

You're right! My apologies, it's failing because I'd since deleted the files I was using to test. I thought I'd tried that when I originally ran into issues but evidently I'm mistaken.