@REALPATH variable function.

Aug 23, 2010
The more I use TCC, the more I need for a way to obtain full, unambiguous path to various system files.
@FULL is useless, as it
…makes no assumption about the existence of a file or directory. The filename parameter can be any string and the function will attempt to turn it into a fully qualified "volume + path + name" specification, whether that full reference exists or not.
Another problem of the @FULL function (same as with @PATH) is that it always preserve trailing slash in paths, leading to cumbersome code when you need to travel directory structure upwards.

My suggestion is to add @REALPATH[ [skip,] filename ] function with the following behavior:
The function walks the directory structure upwards, dereferencing any symlinks and reparse points, except links leading to volume mount points ("\\?\Volume{…}") to recreate the original path to the filename.
The skip parameter, defaults to "0", indicates, how many parts of the original argument are allowed to not exist on the filesystem. If argument contains fewer parts than specified by skip, the warning is issued.
If the function fails to construct path, an empty string is returned.
Similar threads
Thread starter Title Forum Replies Date
vefatica Declined Allow (require?) "0x" in environment variable type 3 (hex) Suggestions 6
Joe Caverly Done Have ESET modify Variable to corresponding type Suggestions 3
Alpengreis Done Suggestion for full osbuild internal variable Suggestions 2
D Done New internal variable _batchpath Suggestions 0
J Done Tooltips should show variable value Suggestions 12
R Done Changed variable window Suggestions 5
Joe Caverly Done Function that returns environment variable type Suggestions 1
R Done Redirect to a variable Suggestions 12
D Done Add the ability to control syntax coloring via an environment variable or some other way Suggestions 3
R Done System variable with TCC folder path Suggestions 8
rps Done TCC count internal variable Suggestions 12
M Declined Brief syntax for %@variable functions on TCMD status bar Suggestions 4
T Done _wintctitle variable Suggestions 13
vefatica Declined Loop on environment variable names? Suggestions 33
E Declined Add option to use SFN for ComSpec variable Suggestions 8
J Done Variable Name Completion Suggestion Suggestions 0
C proper function.... Suggestions 6
Charles Dye @IPADDRESSV6 function Suggestions 1
R @BTWN[low number, high number] function Suggestions 0
mfarah Done pdir /(k) for the output of the @CKSUM function. Suggestions 0
E Done Support for IPv6 (ping function) Suggestions 5
Joe Caverly Done ISLIBRARY Conditional Expression Status Test and Function Suggestions 0
rps Declined @ffind[] function. Suggestions 3
K_Meinhard Done @dowi function Suggestions 2
R (Nearest) Weekday function Suggestions 4
N Done Add display options to new HASH function Suggestions 1
mfarah Done Posix 100.32 compliant %@cksum[] function. Suggestions 12
Joe Caverly Function that converts an expression into a date value Suggestions 0
mikea Done Function to create GUID Suggestions 13
S Declined Character / string classification function Suggestions 9
S Done Enhanced ALIAS, SET, ESET and FUNCTION commands Suggestions 0
M Done Enhancement to @PID function... Suggestions 4
M Declined Function to to verify file name validity... Suggestions 4
S Done Enhanced FUNCTION and ALIAS definition syntax Suggestions 0
S Done Window positioning commands and current position function Suggestions 0
S Declined Indirect function specification Suggestions 2
S Done Command and help enhancement, esp. ALIAS, FUNCTION and SET Suggestions 2
Charles Dye Done @PLUGINVER function Suggestions 0
Charles Dye Done v11 idea - Date picker function Suggestions 3

Similar threads