Hi,
confirmed.
My preferred method is to use always "/" except where I know that
"\\" is necessary (like in function "exec" where "native" paths maybe
required).
In such cases I use:
[file nativename $slashpath]
All path component handling, comparing and managing path names is done
by [file split $path] and [file join $path].
Relative path names are converted to absolute paths with [file normalize
$pat]
The only situation where I could not ignore the platform was the case
sensitivity of file names.
Then you shouldn't have to care about platform specific paths.
Windows:
% file split [file normalize Downloads]
C:/Users gerhard Downloads
is the same directory as
C:/Users gerhard downloads
Whereas on Unix:
/ home gerhard Downloads
and
/ home gerhard downloads
are different directories.
When comparing dir or file names platform code is unavoidable.
if {$::tcl_platform(platform) eq "windows} {
if {[string compare -nocase $path1 $path2] == 0} {
puts "Same path"
}
} else {
if {[string compare $path1 $path2] == 0} {
#or if {$path1 eq $path2} ...
puts "Same path"
}
}
Bye,
Gerhard
--
Gerhard Reithofer - Techn. EDV Reithofer -
http://www.tech-edv.co.at