[TCLCORE] TIP#315: Add pathSeparator to tcl_platform Array
by Donal K. Fellows other posts by this author
Apr 8 2008 3:54AM messages near this date
Re: [TCLCORE] grid behavior
|
Re: [TCLCORE] TIP#315: Add pathSeparator to tcl_platform Array
TIP #315: ADD PATHSEPARATOR TO TCL_PLATFORM ARRAY
===================================================
Version: $Revision: 1.1 $
Author: Hai Vu <haivu2004_at_gmail.com>
State: Draft
Type: Project
Tcl-Version: 8.6
Vote: Pending
Created: Friday, 04 April 2008
URL: http://www.tcl.tk/cgi-bin/tct/tip/315.html
Post-History:
-------------------------------------------------------------------------
ABSTRACT
==========
This TIP proposes a mechanism for determining the platform's path
separator. The path separator is currently ":" in Unix and ";" in
DOS/Windows.
RATIONALE
===========
Under Windows, the PATH environment variable consists of many paths,
separated by semicolons (";"). Meanwhile, Unix uses colon to separate
the paths (":"). Scripts that need to work on both platforms while
parsing platform-specific PATH-like environment variables (PATH is just
the most common of these) currently need to contain the mapping from
platform-type to separator, but this is not especially flexible and
some script authors are also inclined to forget about this particular
difference.
Thus, to aid portability, this TIP proposes adding an element to the
*tcl_platform* array, *pathSeparator*, which descrives the path
separator for the current platform.
EXAMPLE USAGE
===============
The following example prints each component of the PATH environment on
a separate line:
set pathList [split $env(PATH) $tcl_platform(pathSeparator)]
foreach path $pathList {
puts $pathList
}
Alternatively:
puts [string map [list $tcl_platform(pathSeparator) \n] $env(PATH)]
COPYRIGHT
===========
This document has been placed in the public domain.
-------------------------------------------------------------------------
TIP AutoGenerator - written by Donal K. Fellows
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Donal K. Fellows
Donald G Porter
Andreas Leitgeb
Donald Arseneau
Donal K. Fellows
Andreas Leitgeb
|