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

📄 lmutil.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 2 页
字号:

            # 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  }

        # 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
        if { [isTornadoProduct] } {  set infVals(addDestDir) 0  }
        set infVals(addWinFile) 0

        endWaitCursor

    } 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 [lmDirPrompt]
        }

        # check for white spaces
        if {[regexp {[ ]+} [destDirGet]]} {
            puts "Error: [strTableGet LM_DESTDIR_WARN_1]\n"
            return [lmDirPrompt]
        }

        if ![isUnix] {            

            # check if installed in root directory
            if {[regexp {^[a-zA-Z]:[\\|\/]*$} [destDirGet] junk]} {
                puts "[strTableGet LM_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 LM_DESTDIR_WARN_7]\n"
                return [lmDirPrompt]
            }

            # 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 [strTableGet LM_DESTDIR_WARN_8]
                return [lmDirPrompt]

                # then check the rest of the directory names.

            } elseif {[regsub -all {\\[0-9]+} [destDirGet] {} ignore]} {
                puts [strTableGet LM_DESTDIR_WARN_9]
                return [lmDirPrompt]
            }
        }

        if {![file isdirectory [destDirGet]]} {

            # yes = 0 ; no = 1
            puts "Warning: [strTableGet LM_DESTDIR_WARN_3]"

            while (1) {
                switch -regexp -- [prompt] {
                    "^-$"    {  backCallback  }
                    "^[N|n]" {  return [lmDirPrompt]  }
                    "^[Y|y]" {  set doNotCreateDirectory 0 ; break  }
                    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 {![file writable [destDirGet]]} {
                                puts "Error: [strTableGet LM_DESTDIR_WARN_4]\n"
                                return [lmDirPrompt]
                            } else {
                                puts "Error: [strTableGet LM_DESTDIR_WARN_5]\n"
                                return [lmDirPrompt]
                            }
                        }
                    } else {
                        puts "Error: [strTableGet LM_DESTDIR_WARN_6]\n"
                        return [lmDirPrompt]
                    }
                }
                1 {
                    # do not create directory
                    return [lmDirPrompt]
                }
            }
        }

        # Initiate the logging process

        if {"$retVal" == "1"} {
            if {[instTypeGet] != ""} {
               uninstStart [instTypeGet]
            } else {
               uninstStart
            }
        }

        if { [isTornadoProduct] } {  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
        if { [isTornadoProduct] } {  set infVals(addDestDir) 0  }
        set infVals(addWinFile) 0
    }

    return $retVal
}

#############################################################################
#
# lmDirPrompt - 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
# lmDirPrompt
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: return value of nested call to pageProcess(destDir)
#
# ERRORS: N/A
#

proc lmDirPrompt { } {

    puts [strTableGet LM_DESTDIR_LABEL_1_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(lmUtilInst)]
        }
    }
    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
    }
}


proc onReloadLic {} {
    global lmVals ctrlVals
	
    if {[isGUImode]} {
		set w $ctrlVals(mainWindow)
		
		if {[controlChecked $w.reloadCkbox]} {
			set lmVals(reloadExistingLicense) 1
		} else {
			set lmVals(reloadExistingLicense) 0
		}
	} else {
		if {[instTypeGet] != "flexInst"} {
		  puts "Do you want to reload your existing license file? (y/n) \[n\] "
			set ret [prompt]
			if {$ret == "y"} {
				set lmVals(reloadExistingLicense) 1
			} else {
				set lmVals(reloadExistingLicense) 0
			}
		}
	}

    dbgputs "reloadExistingLicense: $lmVals(reloadExistingLicense)"
}


######################################################################
# Dialog Text Messages
######################################################################

set strTable(LM_DESTDIR_TITLE) "License Management Utilities Installation"

set strTable(LM_DESTDIR_LABEL_1) \
	"format %s \"Please type the name of the directory path where you\
	want SETUP to install License Management Utilities.\
	\n\nClick the <Browse> button to choose the directory\
	interactively.\""
set strTable(LM_DESTDIR_LABEL_1_TEXT) \
        "format %s \"Please type the name of the directory path where you\
	want SETUP to install License Management Utilities.\""

set strTable(LM_DESTDIR_LABEL_2) "Destination Directory"

set strTable(LM_DESTDIR_LABEL_3) \
	"Check this box to reload your existing license file."

set strTable(LM_DESTDIR_WARN_1) \
	"format %s \"The installation directory you entered contains white\
	space(s). Please select another directory.\""

set strTable(LM_DESTDIR_WARN_2) \
	"format %s \"Installing License Management utilities in the \
	root directory is not recommended.\nClick <Yes> to select \
	another directory.\""

set strTable(LM_DESTDIR_WARN_2_TEXT) \
	"format %s \"Installing License Management utilities in the root\
        directory is not recommended.  Please select another directory.\""

set strTable(LM_DESTDIR_WARN_3) \
	"The installation directory you entered does not exist.\
	\nDo you want to create it now?"

set strTable(LM_DESTDIR_WARN_4) \
	"You do not have permission to write files into the installation\
	directory you entered.\
	\n\nPlease choose a writable directory."

set strTable(LM_DESTDIR_WARN_5) \
	"format %s \"Unable to create \[destDirGet\].\""

set strTable(LM_DESTDIR_WARN_6) \
	"format %s \"Creating \[destDirGet\] failed: file exists.\""

set strTable(LM_DESTDIR_WARN_7) \
	"Please provide a directory path starting with a drive name."

set strTable(LM_DESTDIR_WARN_8) \
	"Please provide a directory path starting with a letter character."

set strTable(LM_DESTDIR_WARN_9) \
	"Please provide directory names starting with letter characters."

⌨️ 快捷键说明

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