21.1.8 Filenames
(Ask a Question)In Tcl syntax, filenames should be enclosed in braces { } to avoid backslash substitution and white space separation. Backslashes are used to separate folder names in Windows-based filenames. The problem is that sequences of “\n” or “\t” are interpreted specially. Using the braces disables this special interpretation and specifies that the Tcl interpreter handle the enclosed string literally. Alternatively, double-backslash “\\n” and “\\t” would work as well as forward slash directory separators “/n” and “/t”. For example, to specify a file on your Windows PC at c:\newfiles\thisfile.adb, use one of the following:
{C:\newfiles\thisfile.adb}
C:\\newfiles\\thisfile.adb
"C:\\newfiles\\thisfile.adb"
C:/newfiles/thisfile.adb
"C:/newfiles/thisfile.adb"
If there is white space in the filename path, you must use either the braces or double-quotes. For example:
C:\program data\thisfile.adb
should be referenced in Tcl script as
{C:\program data\thisfile.adb} or "C:\\program data\\thisfile.adb"
If you are using variables, you cannot use braces { } because, by default, the braces turn off all special interpretation, including the dollar sign character. Instead, use either double-backslashes or forward slashes with double quotes. For example:
"$design_name.adb"