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

Feb 26, 2013
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
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
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.
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
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.
 
Feb 26, 2013
100
0
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
Thread starter Title Forum Replies Date
D Version 28 LIBRARY changes have side effects Support 3
Dmitry L. Kobyakov How to? How to remove the record of the old version of the Take Command? Support 9
D Documentation WebHelp lands at version 26 Support 4
fishman@panix.com HELP!! I just updated to Version 28 and as usual I cannot make extended directory search work. Support 2
T Take Command 28: Lua reports version 5.4.0 (5.4.3 expected) [SOLVED] Support 1
S Issues with version v26.02.42 x64 Support 0
Joe Caverly Documentation COMMANDS in Version 27 help Support 8
C version help Support 3
R Inconsistency in @version's use of quotes Support 2
thorntonpg What is the latest version of everything Support 1
S Windows Server version not being detected correctly in TCMD 26RC2 Support 9
D Which is the latest version for Windows XP? Support 2
gentzel "Check for Updates" appears to be checking for old version Support 2
D Fixed @VERSION does not increment pre-fixed version numbers. Support 1
nikbackm TCMD 25 - Unregister older TCMD version Support 2
Stefan Hassel Installation file TC 24.02 Build 47 is actually version 25.00.1 Support 10
Joe Caverly What version and Windows OS are you using? Support 3
Dmitry L. Kobyakov From old version: had the setup's error been corrected? Support 6
R How to? Compare executables' version/build # including 123.456.789.01 Support 10
RChrismon How to? Copy TCMD.INI to New Version Support 7
vefatica Windows 10 version number? Support 6
H @ceiling @floor @int not working version 21.01.63 Support 9
B Everything version in Take Command build 39? Support 3
G Version 20.11 installed on Windows 10 problems Support 9
M ANSI is used to show files instead of OEM in version 17 to 19 ! Support 5
E How to? Create a portable version of TCMD to use on other computers w/o installation Support 4
C 21b47 version[] Support 4
fishman@panix.com Version 21.23 fails to install Support 4
E Fixed View command broken in version 21.0 build 22 Support 9
rconn News Take Command + TCC + TCC-RT Version 21 Public Beta (RC1) Support 0
R How to? Not have RT version show on start Support 3
Roedy WAD Version number Support 1
Craig Fitzgerald problem with executable extensons with TCC version 19.10.51 x64 Support 3
Jesse Heines How to? Everything Tool Not Working After Version 20 Installation Support 8
T Portable instructions for version 19 Support 7
cgunhouse Version 19.00.23 Crashes Support 16
vefatica Updater says wrong version Support 1
Sande Nissen TCC/LE version? Support 6
Mordachai Upgrades - can I skip version(s)? Support 2
D Version 18 changed the naming convention of TC's folder Support 5
D Started suggestions, not in this version (yet?) Support 1
fishman@panix.com How about updating the version shown when you upload a new one? Support 4
Joe Caverly PLUGINs and Version 17.0 Support 4
C Is 17.00.55 same as release version? Support 3
Jay Sage Version 17 Installer Leaves Multiple Copies of ShrAlias Support 48
M How to? Start the version of Take Command that I want... Support 7
B Help file problem with version 16 Support 2
T "Checking for a newer version" doesn't complete Support 18
J Required version for Windows 8.1? Support 2
L Windows 8.1 version display Support 5

Similar threads