Version 3 of file separator

Updated 2013-04-17 20:44:21 by pooryorick


[file separator] is used to determine the character used to separate file path elements for the current platform


file separator ?name?


If no argument is given, returns the character which is used to separate path segments for native files on this platform. If a path is given, the filesystem responsible for that path is asked to return its separator character. If no file system accepts name, an error is generated.

[file separator] has been available since version 8.4.2. For previous versions the following [[proc]edure would provide equivalent functionality:

proc file'separator {} {
    switch -- $::tcl_platform(platform) {
        unix    {return /}
        windows {return \\}
        macintosh {return :}
        default {error "unknown platform"}

slebetman: The code code above supports Mac Classic. All recent versions of the MacOS identify themselves as unix.

See Also

file join
file split