Path.tcl
, but no class was defined.
::tycho::autoName
{stem}
::tycho::evalIfNewer
{sourceFile targetFile args}
::tycho::expandPath
{ path }
::tycho::expandPath \$TYCHO/tmpreturns /usr/tools/tycho/tmp. If there is no such environment variable, but a global Tcl variable with the given name exists, then the value of that variable is substituted. If no such variable is defined as well, then an error is reported. Similarly, "~user/foo" will be expanded (on Unix systems) to "/users/user/foo", assuming that "user" has his or her home directory at "/users/user". If there is no user named "user", or we are not on a Unix system, then an error is reported. In all cases, any extra spaces at the beginning or the end of the given path are removed. Moreover, filenames are normalized before being returned. Symbolic links are followed, as are fields in the path like "/../". Thus, any two references to the same path should return the same string.
Formerly, this procedure was in File.itcl, but it was moved so that it could be used in scripts that use itclsh, which does not have windows.#.
::ptkExpandEnvVar
{ path }
::tycho::expandPath
.
::tycho::invoke
{ args }
::tycho::isRelative
{pathname}
::tycho::mkdir
{ args }
::tycho::pathEnvSearch
{filename}
::tycho::pathSearch
{filename path}
::tycho::relativePath
{srcFile dstFile}
::tycho::rootDir
{pathname}
::tycho::rm
{ args }
::tycho::rmIfNotWritable
{ file }
::tycho::simplifyPath
{pathName {envVarList {}}}
For example, if the TYCHO environment variable is set to
/users/ptolemy/tycho
, and this directory is actually
automounted at /export/watson/watson2/ptolemy/tycho
, and
we pass simplifyPath the pathname
/export/watson/watson2/ptolemy/tycho/README
, then we
should get back $TYCHO/README
.
If we cannot simplify the pathname, then we return the original pathname.
If we specify a list of environment variables, then the first environment variable that matches a non-zero number of characters is the environment variable that is used
If we don't specify a list of environment variables (the default), then we return the shortest string that results from subsituting environment variables.
The following example expands and then simplifies $TYCHO/README.files:
::tycho::simplifyPath [::tycho::expandPath \
[file join \$TYCHO README.files]] \
[list TYCHO]]
::tycho::tmpFileName
{ {stem {tytmp}} {extension {}}}
TMPDIR
environment variable is as a base used if it is
present, if TMPDIR
is not present, then /tmp
is used.
If the optional arg `stem' is present, then a unique string is appended
on to it. The stem arg defaults to tytmp.
If the optional arg `extension' is present, then the extension is appended
after the unique string is appended. If extension is the empty string
then nothing is appended. The default is the empty string.
For example, the following command under Unix:
::tycho::tmpFileName myfile .itcl
/tmp/myfile1.itcl
.
::tycho::uniqueFileName
{ {stem {tyuniq}} {extension {}}}
For example
::tycho::uniqueFileName myfile .itcl
myfile1.itcl
.