mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
refactor of server_set_property(), move content of if block into the case statement and check if path is already absolute.
This commit is contained in:
parent
0a637b82b7
commit
af13191bb2
12
init/msm
12
init/msm
@ -1714,15 +1714,15 @@ server_connected() {
|
|||||||
# $2: The name of the server property
|
# $2: The name of the server property
|
||||||
# $3: The value for the property
|
# $3: The value for the property
|
||||||
server_set_property() {
|
server_set_property() {
|
||||||
# If it is a path make that path absolute
|
|
||||||
if [[ "$2" =~ _PATH$ ]]; then
|
|
||||||
server_property "$1" PATH
|
|
||||||
eval SERVER_$2[$1]=\"${SERVER_PATH[$1]}/$3\"
|
|
||||||
else
|
|
||||||
eval SERVER_$2[$1]=\"$3\"
|
eval SERVER_$2[$1]=\"$3\"
|
||||||
fi
|
|
||||||
### Changes to values before setting
|
### Changes to values before setting
|
||||||
case "$2" in
|
case "$2" in
|
||||||
|
*_PATH)
|
||||||
|
server_property "$1" PATH
|
||||||
|
if [[ ! "$3" =~ ^${SERVER_PATH[$1]} ]]; then
|
||||||
|
eval SERVER_$2[$1]=\"${SERVER_PATH[$1]}/$3\"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
SCREEN_NAME)
|
SCREEN_NAME)
|
||||||
eval SERVER_$2[$1]=\"${SERVER_SCREEN_NAME[$1]//\{SERVER_NAME\}/${SERVER_NAME[$1]}}\"
|
eval SERVER_$2[$1]=\"${SERVER_SCREEN_NAME[$1]//\{SERVER_NAME\}/${SERVER_NAME[$1]}}\"
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user