Re: Tilde expansion on (Windows)files?



On Aug 2, 12:37 pm, Gerhard Reithofer <gerhard.reitho...@tech-
edv.co.at> wrote:
Hi,
working on a storage optimization system (millions of files) I realized,
that a tilde in a filename makes problems:

Tcl 8.5.4, Windows XP - test:
  (gerhardr) 4 % set fl [glob y:/WinXP/*]
  {y:/WinXP/~$obkonzept_tech.doc} y:/WinXP/E1007029.exe y:/WinXP/ricohmemory_xp
  (gerhardr) 5 % foreach f $fl {puts [file type $f]}
  could not read "y:/WinXP/~$obkonzept_tech.doc": no such file or directory

What does this mean, which filename is searched?
If it works on Windows (see man page), why doesn't it find the file?

Another problem is, that the file system is served by a unix server
(Samba or NetApp with Unix security) and the file name on which the
program should run, is:
  "/net/pub/WinXP/~$obkonzept_tech.doc"
It doesn't work either.

  How can this file be handled in Tcl?

  Does anyone know a solution for this problem?
--
 Gerhard Reithofer
 Tech-EDV Support Forum -http://support.tech-edv.co.at


Adding a 'file normalize' seems to fix it:
foreach f $fl {set f [file normalize $f];puts [file type $f]}

I've reported this previously as bug id: 2806250 - glob, 'file
exists', 'file normalize' interaction with tilde

This is probably more or less the same as bug 2511011 already
mentioned.

I also made some detailed comments about this whole situation in this
newsgroup recently:
http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/54f4cd8c47eaa406/b3602d39c21d7d81?lnk=gst&q=fiasco#

I was hoping my suggestions in that thread may have got a bit more
response from others - in particular Tcl Core team members. Perhaps
my title of ''file join' behaviour and ye olde tilde fiasco' was too
inflammatory - but frankly.. I still think this area is a mess.

Julian


.



Relevant Pages

  • Re: file command bug on windows
    ... leading tilde is just another symbol on Windows, ... If tcl treats it on a specific way, ... "./~foo" is a ligit filename and is a filename that starts with the ...
    (comp.lang.tcl)
  • Re: file command bug on windows
    ... as documented and is useful in windows as well as in Unix. ... The manual page for `filename` on Tcl 8.4.13 says this: ... The Macintosh and Windows platforms do not support tilde substitution ...
    (comp.lang.tcl)
  • Re: file command bug on windows
    ... If tcl treats it on a specific way, ... You should realize that tilde is also 'just another symbol' on UNIX as ... Windows is not Unix. ...
    (comp.lang.tcl)
  • Re: file command bug on windows
    ... leading tilde is just another symbol on Windows, ... If tcl treats it on a specific way, ... "./~foo" is a ligit filename and is a filename that starts with the ...
    (comp.lang.tcl)
  • Tcl-URL! - weekly Tcl news and links (Mar 1)
    ... "I agree that providing a Windows equivalent of the [canvas ... Tcl3D offers the 3D functionality of OpenGL and other 3D libraries ... tcl3dOglExt Wrapper for enhanced OpenGL functionality. ... The Tcl Windows API extension provides ...
    (comp.lang.tcl)