home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
vscommand.tcl
< prev
next >
Wrap
Text File
|
1997-03-18
|
3KB
|
118 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)vscommand.tcl /main/hindenburg/2
# Author: <generated>
# Description: VCM integration file
#---------------------------------------------------------------------------
# SccsId = @(#)vscommand.tcl /main/hindenburg/2 18 Mar 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
# This class knows how to deal with general VS commands.
# It is an abstract base class for VS specific commands.
Class VSCommand : {GCObject} {
method destructor
constructor
# A description of the command.
#
attribute description
# The command string.
#
attribute command
# Messages resulting from command execution.
#
attribute messages
# Errors resulting from command execution.
#
attribute errors
# Warnings resulting from command execution.
#
attribute warnings
# A list of regexps. Strings matching one of these regexps will
# be filtered from the output.
#
attribute outputFilter
# All command output.
#
attribute output
# Input that must be echoed to the command during execution.
#
attribute input
}
method VSCommand::destructor {this} {
# Start destructor user section
# End destructor user section
}
constructor VSCommand {class this command description} {
set this [GCObject::constructor $class $this]
$this description $description
$this command $command
$this errors ""
$this output ""
$this warnings ""
$this outputFilter ""
$this messages ""
$this input ""
return $this
}
# Searches the PATH envionment variable for a path
# with 'key' as component. Returns this path if 'program'
# is in the directory it specifies.
# Returns the empty string in all other cases.
#
proc VSCommand::findPath {key program} {
if [catch { set envPath $env(PATH) }] {
wmtkerror "environment variable PATH not found"
return
}
# platform specifics
if $win95 {
set pathSep "\\"
set envPathSep ";"
set program "$program.exe"
} else {
set pathSep "/"
set envPathSep ":"
}
foreach pathSpec [split $envPath $envPathSep] {
set dirList [split $pathSpec $pathSep]
set index [lsearch -exact $dirList $key]
if { $index == -1 } {
set index [lsearch -exact $dirList [string toupper $key]]
}
if { $index != -1 } {
# found it.
# if the program is actually there return the path
# make sure path name has forward slashes only.
lappend dirList $program
set fullName [join $dirList "/"]
if [file exists $fullName] {
return $fullName
}
}
}
}
# Do not delete this line -- regeneration end marker