mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
update MLMA
This commit is contained in:
parent
296c4133dd
commit
e35bcdd0ba
@ -22,11 +22,16 @@ message($${TARGET} config path: $$CONFIG_PATH config file: $${CONFIG_FILE})
|
|||||||
ret = $$system(echo APP_DEPLOY_ROOT = >> $${CONFIG_FILE})
|
ret = $$system(echo APP_DEPLOY_ROOT = >> $${CONFIG_FILE})
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty(APP_DEPLOY_ROOT): APP_DEPLOY_ROOT = $$read_ini("$${CONFIG_FILE}", "$${TARGET}", "APP_DEPLOY_ROOT")
|
APP_DEPLOY_ROOT = $$read_ini("$${CONFIG_FILE}", "$${TARGET}", "APP_DEPLOY_ROOT")
|
||||||
|
isEmpty(APP_DEPLOY_ROOT){
|
||||||
|
message([$${TARGET}])
|
||||||
|
message(APP_DEPLOY_ROOT = is required )
|
||||||
|
error( please check app.ini at $$CONFIG_PATH)
|
||||||
|
}
|
||||||
|
|
||||||
message($${TARGET} deploy root: $$APP_DEPLOY_ROOT)
|
message($${TARGET} deploy root: $$APP_DEPLOY_ROOT)
|
||||||
isEmpty(APP_DEPLOY_ROOT):error(APP_DEPLOY_ROOT required please check app.ini at $$CONFIG_PATH)
|
isEmpty(APP_DEPLOY_ROOT):error(APP_DEPLOY_ROOT required please check app.ini at $$CONFIG_PATH)
|
||||||
|
|
||||||
|
|
||||||
defineReplace(deploy_app_on_mac) {
|
defineReplace(deploy_app_on_mac) {
|
||||||
#need QQT_BUILD_PWD
|
#need QQT_BUILD_PWD
|
||||||
command = &&
|
command = &&
|
||||||
|
68
src/linux_write_ini.sh
Normal file
68
src/linux_write_ini.sh
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
function WriteINIfile()
|
||||||
|
{
|
||||||
|
Configfile=$1
|
||||||
|
Section=$2
|
||||||
|
Key=$3
|
||||||
|
NewValue=$4
|
||||||
|
|
||||||
|
WriteINI=`sed -i "/^$Section/,/^/ {/^\[$Section/b;/^\[/b;s/^$Key*=.*/$Key=$NewValue/g;}" $Configfile`
|
||||||
|
echo $WriteINI
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteINIfile $1 $2 $3 $4
|
||||||
|
|
||||||
|
# 解析INI
|
||||||
|
function rini()
|
||||||
|
{
|
||||||
|
# 判断参数数量
|
||||||
|
if [ $# -lt 2 ];then
|
||||||
|
echo 'Usage:ini <filename> <[section]> [<key>] [<newvalue>]'
|
||||||
|
_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 讲ini文件读取到变量
|
||||||
|
_old=`cat $1`
|
||||||
|
|
||||||
|
# 判断变量3是否为空 如果为空 显示该[]下的所有字段
|
||||||
|
if [ "$3" = "" ];then
|
||||||
|
sed -n "/\[$2\]/,/\[.*\]/{
|
||||||
|
/^\[.*\]/d
|
||||||
|
/^[ ]*$/d
|
||||||
|
s/;.*$//
|
||||||
|
p
|
||||||
|
}" $1
|
||||||
|
# 判断变量4是否为空 如果为空 显示该字段的值
|
||||||
|
elif [ "$4" = "" ];then
|
||||||
|
sed -n "/\[$2\]/,/\[.*\]/{
|
||||||
|
/^\[.*\]/d
|
||||||
|
/^[ ]*$/d
|
||||||
|
s/;.*$//
|
||||||
|
s/^[ | ]*$3[| ]*=[ | ]*\(.*\)[ | ]*/\1/p
|
||||||
|
}" $1
|
||||||
|
else
|
||||||
|
# 判断变量4是否为字符'#' 如果为'#' 删除改行
|
||||||
|
if [ "$4" = "#" ];then
|
||||||
|
sed -i "/\[$2\]/,/\[.*\]/{
|
||||||
|
s/^[ | ]*$3[ | ]*=.*/ /
|
||||||
|
}" $1
|
||||||
|
else
|
||||||
|
# 如果变量4不为空和'#' 修改该变量 有备注使用改语句修改
|
||||||
|
sed -i "/\[$2\]/,/\[.*\]/{
|
||||||
|
s/^[ | ]*$3[ | ]*=.*[ | |.*]/$3=$4 /
|
||||||
|
#s/^[ | ]*$3[ | ]*=[a-zA-Z0-9]*.[0-9]*.[0-9]*.[0-9]*/$3=$4/
|
||||||
|
}" $1
|
||||||
|
# 重新读取新文件
|
||||||
|
_new=`cat $1`
|
||||||
|
# 判断是否更改
|
||||||
|
if [ "$_new" = "$_old" ];then
|
||||||
|
# 修改没成功 使用以下语句更改
|
||||||
|
sed -i "/\[$2\]/,/\[.*\]/{
|
||||||
|
s/^[ | ]*$3[ | ]*=.*/$3=$4/
|
||||||
|
#s/^[ | ]*$3[ | ]*=[a-zA-Z0-9]*.[0-9]*.[0-9]*.[0-9]*/$3=$4/
|
||||||
|
}" $1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
@ -104,6 +104,28 @@ defineReplace(get_read_ini_command) {
|
|||||||
#message ($$command)
|
#message ($$command)
|
||||||
return ($$command)
|
return ($$command)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WIN_WRITE_INI = $${PWD}/win_write_ini.bat
|
||||||
|
LINUX_WRITE_INI = $${PWD}/linux_write_ini.sh
|
||||||
|
defineReplace(get_write_ini_command) {
|
||||||
|
file_name = $$1
|
||||||
|
sect_name = $$2
|
||||||
|
key_name = $$3
|
||||||
|
new_value = $4
|
||||||
|
!isEmpty(5): error("get_write_ini_command(file, section, key, value) requires four arguments.")
|
||||||
|
isEmpty(4) : error("get_write_ini_command(file, section, key, value) requires four arguments.")
|
||||||
|
command =
|
||||||
|
win32{
|
||||||
|
#if use $${PWD}/...directoly this PWD is the refrence pri file path
|
||||||
|
command = $${WIN_WRITE_INI} %file_name% %sect_name% %key_name% %new_value%
|
||||||
|
} else {
|
||||||
|
command = chmod +x $${LINUX_WRITE_INI} $$CMD_SEP
|
||||||
|
command += $${LINUX_WRITE_INI} $${file_name} $${sect_name} $${key_name} $${new_value}
|
||||||
|
}
|
||||||
|
#message ($$command)
|
||||||
|
return ($$command)
|
||||||
|
}
|
||||||
|
|
||||||
defineReplace(get_user_home) {
|
defineReplace(get_user_home) {
|
||||||
command =
|
command =
|
||||||
win32{
|
win32{
|
||||||
@ -222,6 +244,20 @@ defineReplace(read_ini) {
|
|||||||
return ($${echo})
|
return ($${echo})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineReplace(write_ini) {
|
||||||
|
file_name = $$1
|
||||||
|
sect_name = $$2
|
||||||
|
key_name = $$3
|
||||||
|
new_value = $$4
|
||||||
|
!isEmpty(5): error("write_ini_command(file, section, key, value) requires four arguments.")
|
||||||
|
isEmpty(4) : error("write_ini_command(file, section, key, value) requires four arguments.")
|
||||||
|
command = $$get_write_ini_command($${file_name}, $${sect_name}, $${key_name}, $${new_value})
|
||||||
|
echo = $$system("$${command}")
|
||||||
|
#message($$command)
|
||||||
|
#message($$echo)
|
||||||
|
return ($${echo})
|
||||||
|
}
|
||||||
|
|
||||||
defineReplace(user_home) {
|
defineReplace(user_home) {
|
||||||
command = $$get_user_home()
|
command = $$get_user_home()
|
||||||
echo = $$system("$${command}")
|
echo = $$system("$${command}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user