mIRC Home    About    Download    Register    News    Help

Topic Options
#265324 - 01/04/19 07:12 PM $findfile doublespace wildfile
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1151
Both $findfile and $finddir can see consecutive spaces in the path parameter, but are ignoring consecutive spaces in the wildfile parameter, causing it to also return all filenames containing only 1 space. Assuming there's at least 1 name having 1 space and at least 1 name having consecutive spaces:

//var %a $+(*,$str($chr(32),2),*) | echo -a %a $len(%a) $findfile(c:\path\,%a,0,echo -a $parms)

//var %a $+(*,$str($chr(32),2),*) | echo -a %a $len(%a) $findfile(c:\path\,* $chr(32) $+ *,0,echo -a $parms)

I know the output can see the spaces because $regex can filter the individual lines but not the grand total.

//var %a $+(*,$str($chr(32),2),*) | echo -a %a $len(%a) $findfile(c:\path\,%a,0,if ($regex($parms,\s\s)) echo -a $parms)

#265326 - 02/04/19 07:58 AM Re: $findfile doublespace wildfile [Re: maroon]
Khaled Offline

Planetary brain

Registered: 04/12/02
Posts: 4445
Loc: London, UK
Thanks for your bug report. This is a known issue. Spaces, such as multiple consecutive, leading, or trailing spaces, are rarely preserved in the script parser. The issue is not only limited to the script parser, it applies to many features, where extra spaces are removed from parameters.

While it is possible to preserve spaces using some combinations of identifiers, that is simply exploiting aspects of the scripting language that happen to work that way. If it works for you in one context, or one identifier, that does not mean that it will work in another one.

There is little that can done other than rewriting the script parser from the ground up to preserve spaces in commands and their parameters, including the addition of quote "" support to delimit strings, and so on, which would likely lead to the breaking of scripts in many ways.