This is not necessarily the current version of this TIP.
| TIP: | 99 |
| Title: | Add 'file link' to Tcl |
| Version: | $Revision: 1.1 $ |
| Author: | Vince Darley <vincentdarley at users dot sourceforge dot net> |
| State: | Draft |
| Type: | Project |
| Tcl-Version: | 8.4 |
| Vote: | Pending |
| Created: | Tuesday, 11 June 2002 |
Tcl can read links, but cannot create them. This TIP proposes adding a file link subcommand to allow cross-platform creation of links.
Add a new subcommand file link source ?target? which creates links. The type of link created will, in general, be a symbolic link, but is up to the file-system which owns source.
The command will take the syntax:
file link source ?target?
If target is not given, then returns the value of the symbolic link given by source (i.e. the name of the file it points to). If source isn't a symbolic link or its value cannot be read, then an error is returned. If target is given then creates a link from source to target. The type of link created is platform specific, but is generally a symbolic or soft link. On systems that don't support symbolic links this option is undefined, and an error message will always be returned. In particular Windows 95, 98 and ME do not support any symbolic links at present. However, Unix, MacOS and Windows NT/2000/XP do.
On MacOS and Unix, symbolic links will be created. On Windows (where supported), symbolic links will be created for directory links, and hard-links for file links (since symbolic file links do not appear to be supported - shortcuts are simply shell aliases).
There are many requests on comp.lang.tcl for this functionality (see http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF8&oe=UTF8&threadm=4dd3bea3.0206100250.95eeb4e%40posting.google.com&rnum=1&prev=/&frame=on for a recent thread), and if Tcl can read links (file readlink, file lstat), it really ought to be able to write them.
There is no cross-platform alternative available. TclX provides a link command for Unix only, and Unix platforms can also use exec ln -s command to achieve the same effect.
http://sourceforge.net/tracker/index.php?func=detail&aid=562970&group_id=10894&atid=310894
This document has been placed in the public domain.
This is not necessarily the current version of this TIP.