Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fixed @version "force" flag not working, and unable to set separator

Feb
100
0
TCC 16.00.27 x64 Windows 7 [Version 6.1.7601]
TCC Build 27 Windows 7 Build 7601 Service Pack 1

Just been trying out the new @version function and it always returns a "versioned" copy of the filename even if the file doesn't exist:

Code:
d:\>dir foo.bar

Volume in drive D is unlabeled      Serial number is 6882:65c2
TCC: (Sys) The system cannot find the file specified.
"D:\foo.bar"
                 0 bytes in 0 files and 0 dirs
1,921,472,241,664 bytes free

d:\>echo %@version[foo.bar]
D:\foo.bar;1

I expected it to return "d:\foo.bar" as the file doesn't exist. If I use the optional force flag it doesn't seem to make any difference what I set it to:

Code:
d:\>echo %@version[foo.bar,;,1,0]
D:\foo.bar;1

d:\>echo %@version[foo.bar,;,1,1]
D:\foo.bar;1

I also can't seem to set the separator character. If I want to change it to an underscore for example, none of these work:
Code:
d:\>echo %@version[foo.bar,_,1,1]
ECHO is OFF

d:\>echo %@version[foo.bar,"_",1,1]
ECHO is OFF

d:\>echo %@version[foo.bar,`_`,1,1]
ECHO is OFF

And finally, the second, third and fourth arguments are described as "optional", but if for example I try to use the first and fourth arguments omitting the second and third the function fails:

Code:
d:\>echo %@version[foo.bar,,,1]
ECHO is OFF
 
And finally, the second, third and fourth arguments are described as "optional", but if for example I try to use the first and fourth arguments omitting the second and third the function fails:

WAD. If you want to specify an optional trailing argument, you must specify the preceding optional arguments as well. (TCC has no magical way of knowing that you meant arguments #1 and #4 instead of #1 and #2.) This is the same as the other variable functions that accept optional arguments.
 
I expected it to return "d:\foo.bar" as the file doesn't exist.

WAD. @VERSION always returns a versioned name. If the file doesn't exist and you don't have the force flag set, it returns an empty string. Or it should; there was a bug that caused it to misread the "force" flag, which was what caused your attempted separator character options to always return an empty string. That has been fixed in build 28.
 
WAD. @VERSION always returns a versioned name. If the file doesn't exist and you don't have the force flag set, it returns an empty string. Or it should; there was a bug that caused it to misread the "force" flag, which was what caused your attempted separator character options to always return an empty string. That has been fixed in build 28.

I'd prefer it that, if the file doesn't exist and the force flag is zero, that the filename is returned unchanged rather than an empty string. Looking at the original request in the user voice forum the expectation was that it would behave that way:

Code:
Example: copy myfile.txt %@mkver[path\myfile.txt]


if path\myfile.txt doesn't exist, the function returns the original 
argument without change.

Returning an empty string means an extra step is needed to either check for the existence of the file first or to check for the return of an empty string. Is it too late to ask for this to be changed in v16 to meet the behaviour as originally requested on the user voice forum. If it's too late in the beta cycle to change I'll add a new request to the feedback forum and see if anyone else agrees with me.

Dan
 

Similar threads

Back
Top