Menu

Incompatibility issue due to formatting of the DIR command output

General
Denis stl
2017-02-19
2017-02-20
  • Denis stl

    Denis stl - 2017-02-19

    There is an incompatibility issue with the "File Selection" dialogs of one of our legacy MS-DOS programs. We don't have the source code of the program.

    After analysis I found this is because the output of the "dir" command is dumped in a temporary text file and parsed by the program in a fragile way. The Dir command show file dates in style 2-10-98 intead of 02-10-98 like in MS-DOS. I think this is what makes the program to crash.

    Is it possible to change this with a setting somewhere in 4DOS.ini, config.txt or autoexec.txt ?

    Regards
    Denis

     
    • Jos Schaars

      Jos Schaars - 2017-02-20

      Like you, I didn’t find such an option.

      If you know the temporary file name, you could do a DIR to that, edit the file and make it read-only. If that works, and the file listing is static, that could be the trick.

      Jos

       
      • Denis stl

        Denis stl - 2017-02-21

        Clever trick! It works.
        The same dump-file is used for two different input filetypes. I can combine both dir lists together, but I have to be very carefull not selecting a file from the other filetype. This even allow me to easily try different layout variants. In fact I was wrong about exact nature of the layout problem: It was not due to the date style but to the position of the filename extension. The extension has to be writen at fixed column positions (cols number 10-11-12). For instance 4DOS also has a switch (justify names) specifically designed for this:
        DIR /j
        The logical question is, can I configure the system to always use this switch by default? It doesn't obey to the classic "Set DIRCMD=/j" and I can't figure out how to do it in 4DOS.ini or elsewhere.
        Thanks, Denis

         
        • Denis stl

          Denis stl - 2017-02-21

          I found how to set permanently the switch in autoexec.bat. It was in the doc:
          alias dir=*dir /j
          So I can remove the read-only protection of the file and it works dynamically.
          Denis