Re: Tilde expansion on (Windows)files?
- From: Gerhard Reithofer <gerhard.reithofer@xxxxxxxxxxxxxx>
- Date: Mon, 3 Aug 2009 12:24:15 +0200
On Sun, 2 Aug 2009, Gerald W. Lester wrote:
Gerhard Reithofer 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?
On Windows a ~$*.doc file is a temporary file that MS Word opens. This file
contains information about which user has the file open, to prevent multiple
users from attempting to change a document at the same time. Hence, it may
have rather strange interactions with normal file system queries.
My question was regarding the man page description
"This works on Unix, MacOS X and Windows (except very old releases)."
but I could not reproduce it on Windows.
All files in my examples are from server backups and are real world
examples for my intended project.
The current situation is, that there are many cases, where Tcl fails (in
sense of runtime errors) unless you catch all these situations.
The reason is an "interpretation" of special characters in filenames,
but in my project I have to handle the files "as they are" and therefore
Tcl may not the right tool if I don't find a reliable solution.
E.g. the tilde expansion only makes sense in a user specific environment
but not on a server where the files of thousands of users must be
handled independently.
In the meantime I've investigated the problem more deeply and igor.g
pointed me to the [subst] solution, that works in all my cases until
now.
The possibility to disable any "interpretation" by an option (e.g.
-nosubst) could solve this problem and would not break any
compatibility.
IMHO: In future versions (>=9) this feature should be removed or
disabled by default.
THX
--
Gerhard Reithofer
Tech-EDV Support Forum - http://support.tech-edv.co.at
.
- Follow-Ups:
- Re: Tilde expansion on (Windows)files?
- From: Mark Janssen
- Re: Tilde expansion on (Windows)files?
- References:
- Tilde expansion on (Windows)files?
- From: Gerhard Reithofer
- Re: Tilde expansion on (Windows)files?
- From: Gerald W. Lester
- Tilde expansion on (Windows)files?
- Prev by Date: Re: Tilde expansion on (Windows)files?
- Next by Date: Problems with KBS on OpenSolaris 10 x86
- Previous by thread: Re: Tilde expansion on (Windows)files?
- Next by thread: Re: Tilde expansion on (Windows)files?
- Index(es):
Relevant Pages
|