TRUENAME limitations

#1
IIRC this issue may have come up in the past. Regardless, on my WinXP SP3
NTFS system TRUENAME does not resolve directory junctions if the parameter
is a file in the junction. It works correctly for the junction (directory)
itself, even through 2 levels of junctions:

real directory tree (partial)

C:\JPSOFT
+--INIKEY
| \--I09
\--PL09

junctions:

C:\JPSOFT\K09\ -> C:\JPSOFT\INIKEY\I09\
C:\JPSOFT\INIKEY\I09\PLUGINS\ -> C:\JPSOFT\PL09

TRUENAME command report

command parameter command output
C:\JPSOFT\K09\ C:\JPSOFT\INIKEY\I09
C:\JPSOFT\K09\PLUGINS\ C:\JPSOFT\PL09
C:\JPSOFT\K09\PLUGINS\FedUtils8.dll C:\JPSOFT\K09\PLUGINS\FedUtils8.dll

The first two, which are directories, are resolved correctly. The last one,
a file, is not resolved at all. The results are identical in 4nt 7.01.370,
4nt 8.02.106, TCC 9.02.154, and the latest test build.
--
Steve
 

rconn

Administrator
Staff member
May 14, 2008
10,321
94
#2
> IIRC this issue may have come up in the past. Regardless, on my WinXP SP3
> NTFS system TRUENAME does not resolve directory junctions if the parameter
> is a file in the junction. It works correctly for the junction (directory)
> itself, even through 2 levels of junctions:
Same answer as before -- it's a Windows API limitation.

Rex Conn
JP Software
 
#3
rconn wrote:
|| ---Quote---
||| IIRC this issue may have come up in the past. Regardless, on my
||| WinXP SP3 NTFS system TRUENAME does not resolve directory junctions
||| if the parameter is a file in the junction. It works correctly for
||| the junction (directory) itself, even through 2 levels of junctions:
|| ---End Quote---
|| Same answer as before -- it's a Windows API limitation.

Undoubtedly you could work around this particular limitation. The batch
program below overcomes it:

@echo off
setlocal
set z=%@attrib[%1,D]
switch %z
case 0
set x=%@path[%@lfn[%1]]
case 1
set x=%@lfn[%1]
endswitch
set t1=%@truename[%x]
set t2=%@truename[%t1]
do while "%t1" NE "%t2"
set t1=%t2
set t2=%@truename[%t1]
enddo
switch %z
case 0
echo %t1\%@filename[%1]
case 1
echo %t1
endswitch

I also defined

function tn=`%@execstr[tn %1]`

Why not encode the same logic into TCC?
--
Steve