1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

@LINES[]?

Discussion in 'Support' started by vefatica, Jun 10, 2010.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    Unlike many other variable functions that give info about a file, @LINES[] screws up the command it's embedded in when the file doesn't exist. Perhaps it could give the string "-2" in that case.

    Code:
    v:\> if "%@crc32[idontexist]" eq "" echo foo
    
    v:\> if "%@md5[idontexist]" eq "" echo foo
    
    v:\> if "%@filesize[idontexist]" eq "" echo foo
    
    v:\> if "%@lines[idontexist]" eq "" echo foo
    TCC: (Sys) The system cannot find the file specified.
     "%@lines[idontexist]"
    Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    ?

    The error is being returned four levels down in the parser; @LINES has no
    way of knowing what failed or why.

    I'd recommend testing for the existence of the file rather than relying on a
    variable function error message. Since there are several hundred functions
    with a wide variety of possible errors, there's no way for the TCC variable
    expansion to deliver detailed error messages without adding a mini-parser to
    every function. And significantly degrading the performance. And VASTLY
    increasing the code size!

    Rex Conn
    JP Software
     

Share This Page