📄 destdir.tcl
字号:
[strTableGet DESTDIR_WARN_8]
set retVal 0
}
# then check the rest of the directory names.
} elseif {[regsub -all {\\[0-9]+} [destDirGet] {} ignore]} {
if { $ctrlVals(useInputScript) } {
autoSetupLog "[strTableGet DESTDIR_WARN_9]"
autoSetupLog "Application Exit\n"
set setupVals(cancel) 1
applicationExit
return 0
} else {
dialog ok_with_title "ERROR: Destination Directory" \
[strTableGet DESTDIR_WARN_9]
set retVal 0
}
}
}
} else { # TEXT mode
set exitVal 0
set retVal 1
# convert all Unix style slashes to backslashes for Windows
if {[isUnix]} {
destDirSet \
[string trim [destDirGet] " "]
} else {
destDirSet [unixToDos \
[string trim [destDirGet] " "]]
}
# check for null directory
if { [destDirGet] == "" } {
return [dirPrompt]
}
# check for white spaces
if {[regexp {[ ]+} [destDirGet]]} {
puts "Error: [strTableGet DESTDIR_WARN_1]\n"
return [dirPrompt]
}
# check for special tcl regexp characters
# one or more instances of ][$^?+*()|{}
# the following regular expression means [special characters]+
if {[regexp "\[\]\[\$\^\?\+\*\(\)\|\{\}\]\+" [destDirGet]]} {
puts "Error: [strTableGet DESTDIR_WARN_10]\n"
return [dirPrompt]
}
# ' and ~ reported to cause problems on Japanese Windows NT
if ![isUnix] {
if {[regexp "\['~\]\+" [destDirGet]]} {
puts "Error: [strTableGet DESTDIR_WARN_11]\n"
return [dirPrompt]
}
}
if ![isUnix] {
# check if installed in root directory
if {[regexp {^[a-zA-Z]:[\\|\/]*$} [destDirGet] junk]} {
puts "[strTableGet DESTDIR_WARN_2_TEXT]\n"
puts "Press: 1 to proceed , 2 to choose different directory"
while (1) {
set ret [prompt]
switch -regexp -- $ret {
"^1$" {
set retVal 1
break
}
"^2$" {
destDirSet $ret
set retVal [pageProcess(destDir)]
break
}
default { }
}
}
}
# make sure directory has drive name and path
if {![regexp {^[a-zA-Z]:[\\|\/]*.+$} [destDirGet] junk]} {
puts "Error: [strTableGet DESTDIR_WARN_7]\n"
return [dirPrompt]
}
# 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]} {
puts "Error: [strTableGet DESTDIR_WARN_8]\n"
return [dirPrompt]
# then check the rest of the directory names.
} elseif {[regsub -all {\\[0-9]+} [destDirGet] {} ignore]} {
puts "Error: [strTableGet DESTDIR_WARN_9]\n"
return [dirPrompt]
}
}
}
if { [isTornadoProduct] } {
# check if installation over existing tree is ok
# skip checking if run SETUP for a license or if because of errors
if { [string compare [instTypeGet] "licenseError"] != 0 && \
[string compare [instTypeGet] "licenseSetup"] != 0 } {
# bypass checking if run with OVERRIDE option
if { [info exist skipInstalloverCheck] && \
$skipInstalloverCheck != 0 } {
dbgputs "SKIPPED checkInstallover"
} else {
if { ![checkInstallover] } { return 0 }
}
}
}
if {![file isdirectory [destDirGet]] && "$retVal" == "1"} {
# test automation
if { [isGUImode] } {
if { $ctrlVals(useInputScript) } {
# yes = 0 ; no = 1
set doNotCreateDirectory 0
} else {
if { [instTypeGet] == "icon" } {
dialog ok "SETUP" \
"You have selected Program Group Installation.\
However, SETUP detected that the directory you entered\
does not exist. [strTableGet DESTDIR_LABEL_1]"
return 0
}
set doNotCreateDirectory \
[dialog yes_no "Setup" [strTableGet DESTDIR_WARN_3]]
}
} else { # TEXT mode
# yes = 0 ; no = 1
puts "Warning: [strTableGet DESTDIR_WARN_3] \[Y\]"
while (1) {
switch -regexp -- [prompt] {
"^$" -
"^[Y|y]" { set doNotCreateDirectory 0 ; break }
"^-$" { backCallback }
"^[N|n]" { return [dirPrompt] }
default { }
}
}
}
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 { $ctrlVals(useInputScript) } {
autoSetupLog "Error in creating new directory: [destDirGet]"
autoSetupLog "Application Exit"
set setupVals(cancel) 1
applicationExit
return 0
} else {
if {![file writable [destDirGet]]} {
if { [isGUImode] } {
messageBox [strTableGet DESTDIR_WARN_4]
} else {
puts "Error: [strTableGet DESTDIR_WARN_4]"
return [dirPrompt]
}
} else {
if { [isGUImode] } {
messageBox [strTableGet DESTDIR_WARN_5]
} else {
puts "Error: [strTableGet DESTDIR_WARN_5]"
return [dirPrompt]
}
}
}
set retVal 0
}
# test automation
if { $ctrlVals(useInputScript) } {
autoSetupLog "\tCreating new directory: [destDirGet]"
}
} else {
if { ![isGUImode] } {
puts "Error: [strTableGet DESTDIR_WARN_6]"
return [dirPrompt]
} else {
if { $ctrlVals(useInputScript) } {
autoSetupLog "[strTableGet DESTDIR_WARN_6]"
} else {
messageBox [strTableGet DESTDIR_WARN_6]
}
}
set retVal 0
}
}
1 {
# do not create directory
if { [isGUImode] } {
set retVal 0
} else {
return [dirPrompt]
}
}
}
} else {
# test automation
if { $ctrlVals(useInputScript) } {
autoSetupLog "\tOverwrite existing directory: [destDirGet]"
}
}
# Initiate the logging process
if {"$retVal" == "1"} {
if {[instTypeGet] != ""} {
uninstStart [instTypeGet]
} else {
uninstStart
}
}
if { [isTornadoProduct] } { set infVals(addDestDir) 1 }
set prod [string toupper [getProdInfo name]]
searchAndProcessSection AddRegistry [cdFileNameGet [file join RESOURCE \
INF $prod.INF]]
queueExecute
if { [isTornadoProduct] } {
set infVals(addFolder) 0
set infVals(addDestDir) 0
}
# set WIND_BASE to destDir so that archiving will succeed for SETUP
set env(WIND_BASE) [destDirGet]
return $retVal
}
#############################################################################
#
# dirPrompt - creates a prompt loop for getting the destination directory
#
# This procedure will loop until a valid destination directory is entered or
# the user exits
#
# SYNOPSIS
# .tS
# dirPrompt
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: return value of nested call to pageProcess(destDir)
#
# ERRORS: N/A
#
proc dirPrompt { } {
puts [strTableGet DESTDIR_LABEL_3_TEXT]
set ret [prompt]
while { $ret == "" } {
set ret [prompt]
}
switch -regexp -- $ret {
"^-$" {
backCallback
}
"[eE][xX][iI][tT]" {
return 0
}
default {
destDirSet $ret
set retVal [pageProcess(destDir)]
}
}
return $retVal
}
#############################################################################
#
# 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
}
}
#############################################################################
#
# checkInstallover - check INSTALLOVER.INF file for installation regulations
#
# This procedure checks INSTALLOVER.INF file for installation validation
# rules (for Tornado product only). This procedure is called when SETUP
# detects that user is trying to install the CD over an existing Tornado tree.
#
# SETUP warns, logs error, and allows to proceed:
# - if setup.log or INSTALLOVER.INF files not found or cannot be opened/read
# - if missing rule (no "CD-TDK" that matches this CD image)
# - if installed tree is incompatible, when "compatible-TDKs" does not
# match with the one found in setup.log
#
# SYNOPSIS
# .tS
# checkInstallover
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -