home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)vscommand.tcl /main/titanic/4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)vscommand.tcl /main/titanic/4 14 Oct 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
- method addTempFile
- method removeTempFiles
-
- # A description of the command.
- #
- attribute description
-
- # The command string.
- #
- attribute command
-
- # Errors resulting from command execution.
- #
- attribute errors
-
- # Warnings resulting from command execution.
- #
- attribute warnings
-
- # All command output.
- #
- attribute output
-
- # Input that must be echoed to the command during execution.
- #
- attribute input
-
- # Temporary files used by this command.
- #
- attribute tempFiles
- }
-
- 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 tempFiles ""
- $this input ""
- return $this
- }
-
-
- # Add tempFile to tempFiles.
- #
- method VSCommand::addTempFile {this tempFile} {
- set tempFiles [$this tempFiles]
- append tempFiles " [list $tempFile]"
- $this tempFiles $tempFiles
- }
-
-
- # Remove the temporary files listed in
- # the tempFiles instance variable.
- #
- method VSCommand::removeTempFiles {this} {
- foreach tempFile [$this tempFiles] {
- catch { BasicFS::removeFile $tempFile }
- }
- }
-
-
- # 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
-
-