Use of --targetdir option

2002-10-22
2002-10-23
  • Arend van Beelen jr.

    Hi,

    Recently I released a project of mine on SourceForge (http://www.sourceforge.net/projects/adms), it's a webbased Document Management System to which people can add documents. People like to add Word documents to it, while the system preferes HTML for it being webbased. So the system can convert these documents easily to HTML by using (you had already guessed it): wvHtml. Now the system calls the wvHtml utility with its arguments and simply calls it in the form of "wvHtml <input file> <output file>", but now wvHtml starts mourning about using the --targetdir option when the input file and output file are not in the same directory. To solve this problem I made a very small hack to the wvHtml script (version 0.7.2). I replaced the following four lines

    if test "x$o_file" != "x$name"; then
    echo "* * * Better to use '--targetdir' for writing in another directory * * *"
    exit 1
    fi

    with this:

    if test "x$o_file" != "x$name"; then
    t_dir=`dirname "$o_file"`
    o_file=$name
    fi

    This works fine now. Now I would like to ask, could you include this little hack in future version of wvHtml or did you have some other reason why you specifically did not use it?

    Thanks,

    Arend jr.

     
    • Evan

      Evan - 2002-10-22

      Although I am not a developer on this project, but being a rather paranoid security freak and unix administrator my guess would have to be that it is security releated so that you don't overwrite an existing file without knowing it. (Kindda like the reason having '.' in your path is a horrible idea).

      I think a better replacement for those four lines would be:

      if test "x$o_file" != "x$name" and test -f ./$o_file; then
      echo "* * * Better to use '--targetdir' for writing in another directory * * *"
      exit 1
      else
      t_dir=`dirname "$o_file"`
      o_file=$name
      fi

      Then it would complain if the file already existed in the current working directory, but not if the file doesn't exist.
      Then your script which is calling wvHtml can testing for the existance of a file and remove it before invoking wvHtml (after prompting the user to overwrite the file of course....)

       
    • Francis James Franklin

      I've forgotten all the details of my reasoning, but part of it was because i was making a significant behavioural change and I wanted users to notice this and adjust rather than continuing to use the new scripts exactly as they used the old scripts.

      A lot of the script re-writes had to do with problems occuring when paths have spaces in them:

      wvWare "My Documents/School Holidays.doc" "Web Documents/School Holidays.html"

      having interesting results previously. Relative URLs, within the HTML output, to the document's images are handled better now as well. (I think. I forget the details.)

      Frank

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks