📄 destdir.tcl
字号:
# DESTDIR.TCL - Setup procedures for implementing destination-directory# wizard page## Copyright 1999 Wind River Systems, Inc## modification history# --------------------# 03p,14jan03,wmd Fix SPR #85387, set WIND_BASE here so that archiving will# work for Setup.# 03o,23aug02,bjl fixed checkInstallover return line (spr 80894).# 03n,12jul02,wmd Prevent installover warning message for a BSP installation.# 03m,03may02,bwd SPR 74983: Modified checkInstallOver to check ALL previous# installation records# 03l,03may02,bjl prevent destdir with special tcl characters (spr 75147).# 03k,05mar02,bwd Modified SETUP to be non-tornado centric# 03j,18jan02,wmd Fix so installover check doesn't affect useInputScript# mode.# 03i,09jan02,bwd Fixed typo# 03h,09jan02,bwd For BSP CD, warn if install in fresh or non-tornado tree# 03g,09jan02,bwd Modified warning message# 03f,07jan02,bwd Updated/added more comments for checkInstallover# 03e,04jan02,bwd INSTALLOVER: redesigned to use hard-coded table.# 03d,21dec01,bwd Added codes to handle BSP CD installation# 03c,03dec01,bwd INSTALLOVER: added a case to check for empty setup.log# 03b,01nov01,bwd Modified codes to allow or prevent installation over an# existing directory# 03a,12jun01,j_w Modified for Tornado 2.2# 02z,07may01,wmd Fix bug, instname NOT found when installing over existing# tree.# 02y,25apr01,wmd Need to add more modifications for spr 66729.# 02x,23apr01,wmd Fix spr #66729, should not check other products for# previous install.# 02w,15mar01,wmd Fix spr 64156, modify Setup's behaviour with respect to# versions.# 02v,15dec00,wmd Fix punctuation.# 02u,15dec00,wmd Fix punctuation error.# 02t,02nov00,j_w Name change - Tornado AE# 02s,18aug00,bwd SPR 32628: if T1/T2 prev installed set dest dir and # folder name to default values# 02r,18aug00,bwd Fixed Typo: SPR 32628 - do NOT display destination# directory field if T1 or T2 has been previously installed.# 02q,17aug00,bwd SPR 32628: clear out dest dir field if T1 or T2 tree has# been installed. Added searchAndProcessSection to write# destDir to registry# 02p,09aug00,bwd Removed searchAndProcessSection - this is done in# APPCONFG.TCL. SPR 32140: remove workaround for# bootrom problem in Beta 1# 02o,08jun00,bwd Re-display SETUP bitmap# 02n,02jun00,bwd Changed all "dialog ok" to use "dialog ok_with_title"# 02m,03may00,j_w Change the 18 characters limits to 17# 02l,01may00,j_w Removed trailing slashes from the destination path# 02k,26apr00,j_w Gave a warning if WIND_BASE greater than 18 characters# (due to bootrom path problem in beta-1)# 02j,20mar00,bwd Fixed TEXT mode to default YES to create a directory upon# prompting user# 02i,31jan00,bwd Fixed error handling for test automation. Deleted# redundant codes. Replaced setupVals(cmdMode) with isGUImode# 02h,13jan00,bwd Fixed error handling for TEXT MODE when prompting for a# directory# 02g,06jan00,bwd No test automation for command line SETUP# 02f,17dec99,clc change switch patterns# 02e,16nov99,clc change text mode variable to setupVals(cmdMode)# 02d,07nov99,clc add exit for text mode# 02c,28oct99,clc add text mode# 02b,14oct99,j_w Added more comments# 02a,30Sep99,j_w Modified for T3# 01e,23jul99,j_w added text messages# 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.#global setupValsglobal installRules############################################################################### 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 { [isBSPcd] } { set msg [strTableGet DESTDIR_LABEL_6] set labelText [strTableGet DESTDIR_LABEL_5] } elseif { $setupVals(cmdMode) == "icon"} { set msg [strTableGet DESTDIR_LABEL_1] set labelText [strTableGet DESTDIR_LABEL_2] } elseif { $setupVals(installChoice) == "onPrgGrpInstall" } { set msg [strTableGet DESTDIR_LABEL_SHORTCUTS] set labelText [strTableGet DESTDIR_LABEL_2] } else { set msg [strTableGet DESTDIR_LABEL_3] set labelText [strTableGet DESTDIR_LABEL_4] } windBaseReadFromRegistry if {$setupVals(installChoice) == "onPrgGrpInstall"} { destDirSet "" } if { [isTornadoProduct] } { # if tornado 1 or 2 is previously installed, do not # display the old WIND_BASE (destination directory) and # folder name values. if { [previousTornadoInstalled] } { if {[windHostTypeGet] == "x86-win32"} { destDirSet $setupVals(defDestDirWin32) } else { destDirSet $setupVals(defDestDirUnix) } defGroupSet $setupVals(defGroup) set infVals(addFolder) 1 } } if { [isGUImode] } { # unhide the setup bitmap controlHide wizardDialog.bitmap 0 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 150 -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] \ ] set w [dlgFrmCreate [strTableGet DESTDIR_TITLE]] controlValuesSet $w.dirText [destDirGet] controlFocusSet $w.dirText # test automation if { $ctrlVals(useInputScript) } { autoSetupLog "Destination page:" autoSetupLog "\tDestination Directory: [destDirGet]" nextCallback } } else { # TEXT mode printPageTitle [strTableGet DESTDIR_TITLE] if { [isBSPcd] } { puts [strTableGet DESTDIR_LABEL_3_BSP_TEXT] } else { puts [strTableGet DESTDIR_LABEL_3_TEXT] } puts "\[[destDirGet]\]\n" while (1) { set ret [prompt] switch -regexp -- $ret { "^-$" { backCallback return 0 } "^$" { nextCallback return 0 } "[eE][xX][iI][tT]" { return 0 } default { if [regexp {~} $ret ] { puts "Error: Invalid directory specified\n" } else { destDirSet $ret nextCallback return 0 } } } } }}############################################################################### 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 global skipInstalloverCheck global env set retVal 1 set changeDir 0 if { [isGUImode] } { #beginWaitCursor set destDir [controlValuesGet $ctrlVals(mainWindow).dirText] # convert all Unix style slashes to backslashes for Windows # and remove trailing slashes if {[isUnix]} { set dpath [string trim $destDir " "] set dirname [file dirname $dpath] set tail [file tail $dpath] destDirSet "[file join $dirname $tail]" } else { set dpath [unixToDos [string trim $destDir " "]] set dirname [file dirname $dpath] set tail [file tail $dpath] destDirSet "[unixToDos [file join $dirname $tail]]" } dbgputs "destDir = [destDirGet]" # check for white spaces if {[regexp {[ ]+} [destDirGet]]} { if { $ctrlVals(useInputScript) } { autoSetupLog "[strTableGet DESTDIR_WARN_1]" autoSetupLog "Application Exit\n" set setupVals(cancel) 1 applicationExit return 0 } else { dialog ok_with_title "ERROR: Destination Directory" [strTableGet DESTDIR_WARN_1] set retVal 0 } } # check for special tcl regexp characters # one or more instances of ][$^?+*()|{} # the following regular expression means [special characters]+ if {[regexp "\[\]\[\$\^\?\+\*\(\)\|\{\}\]\+" [destDirGet]]} { if { $ctrlVals(useInputScript) } { autoSetupLog "[strTableGet DESTDIR_WARN_10]" autoSetupLog "Application Exit\n" set setupVals(cancel) 1 applicationExit return 0 } else { dialog ok_with_title "ERROR: Destination Directory" [strTableGet DESTDIR_WARN_10] set retVal 0 } } # ' and ~ reported to cause problems on Japanese Windows NT if ![isUnix] { if {[regexp "\['~\]\+" [destDirGet]]} { if { $ctrlVals(useInputScript) } { autoSetupLog "[strTableGet DESTDIR_WARN_11]" autoSetupLog "Application Exit\n" set setupVals(cancel) 1 applicationExit return 0 } else { dialog ok_with_title "ERROR: Destination Directory" [strTableGet DESTDIR_WARN_11] set retVal 0 } } } if ![isUnix] { # check if installed in root directory if {[regexp {^[a-zA-Z]:[\\|\/]*$} [destDirGet] junk]} { if { $ctrlVals(useInputScript) } { autoSetupLog "[strTableGet DESTDIR_WARN_2]" autoSetupLog "Application Exit\n" set setupVals(cancel) 1 applicationExit return 0 } else { if {![dialog yes_no "Setup" [strTableGet DESTDIR_WARN_2]]} { set retVal 0 } } } # make sure directory has drive name and path if {![regexp {^[a-zA-Z]:[\\|\/]*.+$} [destDirGet] junk]} { if { $ctrlVals(useInputScript) } { autoSetupLog "[strTableGet DESTDIR_WARN_7]" autoSetupLog "Application Exit\n" set setupVals(cancel) 1 applicationExit return 0 } else { dialog ok_with_title "ERROR: Destination Directory" \ [strTableGet DESTDIR_WARN_7] 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 { $ctrlVals(useInputScript) } { autoSetupLog "[strTableGet DESTDIR_WARN_8]" autoSetupLog "Application Exit\n" set setupVals(cancel) 1 applicationExit return 0 } else { dialog ok_with_title "ERROR: Destination Directory" \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -