⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 destdir.tcl

📁 T2.0 USB driver.rar T2.0 USB driver.rar
💻 TCL
字号:
# DESTDIR.TCL - Setup procedures for implementing destination-directory#               wizard page## Copyright 1999 Wind River Systems, Inc## modification history# --------------------# 01f,22may01,j_w  Allowed the same product for re-installation# 01e,11may01,j_w  Added checking for products which cannot be installed #                  on any existing T2 tree# 01d,31mar99,bjl  set infVals(addWinFile) for Windows hosts (spr 26136, 26205).# 01c,24mar99,bjl  turn off inf write to registry after queueExecute.# 01b,22mar99,bjl  added beginWaitCursor for page processing.# 01a,26jan99,tcy  extracted from INSTW32.TCL.################################################################################ pageCreate(destDir) - prompt users for destination directory## This procedure will prompt users for destination directory## SYNOPSIS# .tS# pageCreate(destDir)# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc pageCreate(destDir) {} {    global ctrlVals    global setupVals    if {[instTypeGet] == "icon"} {        set msg [strTableGet 1100_REMOTE_DIR]        set labelText "Remote Directory"    } else {        set msg [strTableGet 1100_DEST_DIR]        set labelText "Destination Directory"    }    set ctrlVals(volatileFrm) [list \                [list label -name dirLabel \                            -title $msg \                            -x 100 -y 10 \                            -w 186 -h 80] \                [list label -name dirLabelText \                            -title $labelText \                            -x 105 -y 136 -w 100 -h 8] \                [list frame -name dirFrame \                            -x 100 -y 146 -w 205 -h 24] \                [list text -name dirText -border \                           -x 104 -y 151 \                           -w 140 -h 14] \                [list button -name browse -title "B&rowse" \                             -callback {onBrowse dirText} \                             -x 249 -y 151 -w 50 -h 14] \    ]    windBaseReadFromRegistry    set w [dlgFrmCreate [strTableGet 1440_TITLE_DESTDIR]]    controlValuesSet $w.dirText [destDirGet]    controlFocusSet $w.dirText    # test automation    if { $ctrlVals(useInputScript) } {        autoSetupLog "Destination page:"        autoSetupLog "\tDestination Directory: [destDirGet]"        nextCallback    }}############################################################################### pageProcess(destDir) - process inputs from destDir page## This procedure will process inputs from destDir page## SYNOPSIS# .tS# pageProcess(destDir)# .tE## PARAMETERS: N/A## RETURNS: 0 if destination directory is unacceptable#          1 if destination directory is acceptable## ERRORS: N/A#proc pageProcess(destDir) {} {    global setupVals    global ctrlVals    global infVals    global overwritePolicy    set retVal 1    set changeDir 0        beginWaitCursor    # convert all Unix style slashes to backslashes for Windows    if {[isUnix]} {        destDirSet \            [string trim [controlValuesGet $ctrlVals(mainWindow).dirText] " "]    } else {        destDirSet [unixToDos \            [string trim [controlValuesGet $ctrlVals(mainWindow).dirText] " "]]    }    if {[regexp {[ ]+} [destDirGet]]} {        if {![dialog ok "Setup" [strTableGet 1135_DEST_DIR_WARN4]]} {            set retVal 0        }    }    if {[regexp {^[a-zA-Z]:[\\|\/]*$} [destDirGet] junk]} {        if {![dialog yes_no "Setup" [strTableGet 1111_DEST_DIR_WARN]]} {            set retVal 0        }    }    if ![isUnix] {        # make sure directory has drive name and path        if {![regexp {^[a-zA-Z]:[\\|\/]*.+$} [destDirGet] junk]} {            if {![dialog ok "Setup" "Please provide a directory path starting\                                 with a drive name."]} {                set retVal 0            }        }        # make sure no directory in path starts with a number        # check the first name in the directory path.        if {[regexp {^[a-zA-Z]:[\\|\/]*[0-9]+} [destDirGet] junk]} {            if {![dialog ok "Setup" \                "Please provide a directory path starting with a letter\                 character."] } {                set retVal 0            }        # then check the rest of the directory names.        } elseif {[regsub -all {\\[0-9]+} [destDirGet] {} ignore]} {            if {![dialog ok "Setup" \                "Please provide directory names starting with letter\                 characters."] } {                set retVal 0            }        }    }        set existingPoolId [existingPoolIDGet]    dbgputs "installed poolId = $existingPoolId"        set cdPoolId [cdNameGet number]    dbgputs "CD poolId = $cdPoolId"        # if the TDK number from the setup.log is as same as the one in    # DISK_ID, then skip checking coz this is a re-installation        if {[string compare "$existingPoolId" "$cdPoolId"] != 0} {            # check for any products that cannot be installed on top of any         # existing T2 tree. Look for products in NEWTREE.INF        set cdDesc [cdNameGet description]        set setupLog [file join [destDirGet] setup.log]        set hostPath [file join [destDirGet] host]        set setupPath [file join [destDirGet] SETUP]            #dbgputs $setupLog        #dbgputs $hostPath                                                                                  set msg "$cdDesc must be installed on a different directory which\                does not have any existing Tornado files. \n\nPress OK to\                select another directory."                if {[file exists "$setupLog"] || \            [file exists "$hostPath"] || \            [file exists "$setupPath"] }  {                    if {[installOnNewTree]} {                if {![dialog ok "Setup" $msg] } {                        set retVal 0                }            }        }         }    if {![file isdirectory [destDirGet]] && "$retVal" == "1"} {        # test automation        if { !$ctrlVals(useInputScript) } {            # yes = 0 ; no = 1            set doNotCreateDirectory \                [dialog yes_no "Setup" [strTableGet 1110_DEST_DIR_WARN]]        } else {            set doNotCreateDirectory 0        }        switch $doNotCreateDirectory {            0 {                # create directory                if {![file exists [destDirGet]]} {                    # workaround for: overWritePolicy dialog box appears                    # even if user installs to a new directory                    set overwritePolicy(ALL) 1                    if {[catch {file mkdir [destDirGet]} error]} {                        if {![file writable [destDirGet]]} {                            messageBox [strTableGet 1130_DEST_DIR_WARN3]                        } else {                            messageBox [strTableGet 1122_DEST_DIR_WARN2]                        }                        set retVal 0                    }                    # test automation                    if { $ctrlVals(useInputScript) } {                       autoSetupLog "\tCreating new directory: [destDirGet]"                    }                } {                   # test automation                   if { !$ctrlVals(useInputScript) } {                        messageBox [strTableGet 1120_DEST_DIR_WARN2]                   } else {                        autoSetupLog "[strTableGet 1120_DEST_DIR_WARN2]"                   }                   set retVal 0                }            }            1 {                # do not create directory                set retVal 0            }        }    } else {        # test automation        if { $ctrlVals(useInputScript) } {            autoSetupLog "\tOverwrite existing directory: [destDirGet]"        }    }    # Initiate the logging process    if {"$retVal" == "1"} {        if {[instTypeGet] != ""} {            uninstStart [instTypeGet]        } else {            uninstStart        }    }    set infVals(addDestDir) 1    # register file types only on Windows hosts since MainWin does    # not show file extensions with file dialogs.       if {![isUnix] && $infVals(addDestDir)} {        set infVals(addWinFile) 1         } else {        set infVals(addWinFile) 0         }    searchAndProcessSection AddRegistry [cdFileNameGet [file join RESOURCE \                                         INF TORNADO.INF]]    queueExecute    set infVals(addDestDir) 0    set infVals(addWinFile) 0    return $retVal}############################################################################### windBaseReadFromRegistry - read WIND_BASE value from registry and set#                            it as default installation location## This procedure will read WIND_BASE value from registry and set# it as default installation location## SYNOPSIS# .tS# windBaseReadFromRegistry# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc windBaseReadFromRegistry {} {    global setupVals    # Initialize wind_base from registry    if {"[destDirGet]" == ""} {        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \                "Software\\$setupVals(WRS)" "WIND_BASE"} destDir]} {            destDirSet $destDir        } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \                "SOFTWARE\\$setupVals(WRS)" "WIND_BASE"} destDir]} {            destDirSet $destDir        } else {            if {[windHostTypeGet] == "x86-win32"} {                destDirSet "C:\\Tornado"            } else {                destDirSet /usr/wind            }        }    }}############################################################################### onBrowse - set the value in edit box when a directory is selected#            from the browse window## This procedure will set the value in edit box when a directory is selected# from the browse window## SYNOPSIS# .tS# onBrowse <ctrlName># .tE## PARAMETERS:# .IP ctrlName# control name which will have the new value## RETURNS: N/A## ERRORS: N/A#proc onBrowse {ctrlName} {    global ctrlVals    set retDir [dirBrowseDialogCreate -title "Directory"]    if {"$retDir" != ""} {        controlValuesSet $ctrlVals(mainWindow).$ctrlName $retDir    }}proc installOnNewTree {} {    global env        set retVal 0    set cdDesc [cdNameGet description]    set prodFile [file join $env(CD_ROOT) RESOURCE INF NEWTREE.INF]         dbgputs "CD Name: $cdDesc"    #puts "prodFile: $prodFile"        set prodLists ""       # read the file    if {![catch {open $prodFile "r"} f]} {        while {[gets $f line] >= 0} {            if {![regexp {^#} [string trimleft $line] ]} {                lappend prodLists $line            }        }                      } else {        dialog ok "Setup" "Error in reading $prodFile"        return 0    }        dbgputs "prodLists: $prodLists"                              foreach name $prodLists {        if {[string compare $name $cdDesc] == 0} {            # match            set retVal 1        } else {            set retVal 0        }    }        return $retVal}   proc existingPoolIDGet {} {    # open the setup.log file and get the installed TDK number        set logfile [file join [destDirGet] setup.log]        if [catch {open $logfile r} logfd] {        return ""    }         set poolId ""    while {[gets $logfd line] >= 0} {        if {[regexp {(TDK-[0-9]+-[a-zA-Z]+-[0-9]+)} $line poolId]} {            set retVal $poolId            break        }    }    close $logfd        return $poolId             }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -