Re: file command bug on windows
- From: Robert Heller <heller@xxxxxxxxxxxx>
- Date: Sun, 05 Apr 2009 15:22:03 -0500
At Sun, 05 Apr 2009 20:31:28 +0200 =?windows-1252?Q?=D3scar_Fuentes?= <ofv@xxxxxxxxxx> wrote:
Mark Janssen <mpc.janssen@xxxxxxxxx> writes:
This has not to do with the file command, but with Tcl's file name% file type ~123
user "123" doesn't exist
% file type ~456
user "456" doesn't exist
% cd ~456
user "456" doesn't exist
resolution of ~ (as evident from the cd error). If filenames starting
with ~ are allowed in your application, you can sanitize them with
code like this:
% regsub {^~} ~456~78 ./&
./~456~78
Thanks for the solution. That will work...
But I was just wanted to know if "file", "cd", etc. should have been
written
to ignore interpreting  "~dir" as a user's home directory.
No, why would you want to do that -- each user has a valid home directory.
BTW, on most other file systems you can also put a tilde in a file name.
Just like on windows it is very very very rarely put at the beginning of a
file name (one of the common *inx editors, Emacs, puts it at the end of a
file name to indicate a backup file).
Yes, I agree that every user has a valid home directory. But on
Windows the user's home
directories are not referred to with a leading tilde symbol. That
convention is used
only on Unix'es and maybe other OS's. So I was just wondering if the
relevant commands
should ignore this convention on Windows. Not that its a major problem
though, with
Suchenwi's solution.
The fact that ~something is interpreted as a home directory is working
as documented and is useful in windows as well as in Unix.
Well, it may be documented, it may be useful, but it is broken. A
leading tilde is just another symbol on Windows, and it is not different
from an 'A'. If tcl treats it on a specific way, Tcl is broken.
You should realize that tilde is also 'just another symbol' on UNIX as
well. It is just that *tradionally* it is a shorthand (in sh, csh,
bash, etc.) for a users home directory as well, and this shorthand usage
is also used in tclsh/wish, as well as other. The 'trick' of
preceding a leading tilde with a directory spec (eg "./") to suppress
the home directory substitution works for UNIX as well. Under UNIX
"./~foo" is a ligit filename and is a filename that starts with the
literal character '~'. A bit awkward do deal with from a command
shell, but not any worse than a filename starting with a dash.
[snip]
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@xxxxxxxxxxxx -- Contract Programming: C/C++, Tcl/Tk
.
- Follow-Ups:
- Re: file command bug on windows
- From: Óscar Fuentes
- Re: file command bug on windows
- References:
- Re: file command bug on windows
- From: Óscar Fuentes
- Re: file command bug on windows
- Prev by Date: Problem with building Tcl both with and without symbols
- Next by Date: Re: file command bug on windows
- Previous by thread: Re: file command bug on windows
- Next by thread: Re: file command bug on windows
- Index(es):
Relevant Pages
|