mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
Don't error if file does not exists when updating a config option
move update before and use bin dir var
This commit is contained in:
parent
9920f01cb8
commit
689c51782c
@ -100,6 +100,9 @@ set(RESOURCE_FILES "sharedconfig.ini" "authconfig.ini" "chatconfig.ini" "worldco
|
||||
message(STATUS "Checking resource file integrity")
|
||||
|
||||
include(Utils)
|
||||
UpdateConfigOption(${PROJECT_BINARY_DIR}/authconfig.ini "port" "auth_server_port")
|
||||
UpdateConfigOption(${PROJECT_BINARY_DIR}/chatconfig.ini "port" "chat_server_port")
|
||||
UpdateConfigOption(${PROJECT_BINARY_DIR}/masterconfig.ini "port" "master_server_port")
|
||||
|
||||
foreach(resource_file ${RESOURCE_FILES})
|
||||
set(file_size 0)
|
||||
@ -115,9 +118,6 @@ foreach(resource_file ${RESOURCE_FILES})
|
||||
)
|
||||
message(STATUS "Moved " ${resource_file} " to project binary directory")
|
||||
elseif(resource_file MATCHES ".ini")
|
||||
UpdateConfigOption("build/authconfig.ini" "port" "auth_server_port")
|
||||
UpdateConfigOption("build/chatconfig.ini" "port" "chat_server_port")
|
||||
UpdateConfigOption("build/masterconfig.ini" "port" "master_server_port")
|
||||
message(STATUS "Checking " ${resource_file} " for missing config options")
|
||||
file(READ ${PROJECT_BINARY_DIR}/${resource_file} current_file_contents)
|
||||
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
|
||||
|
@ -7,6 +7,10 @@ function(UpdateConfigOption file_name old_option_name new_option_name)
|
||||
string(APPEND old_option_name "=")
|
||||
string(APPEND new_option_name "=")
|
||||
message(STATUS "Checking " ${file_name} " for " ${old_option_name} " and adding " ${new_option_name} " if it does not exist")
|
||||
if(NOT EXISTS ${file_name})
|
||||
message(STATUS ${file_name} " does not exist. Doing nothing")
|
||||
return()
|
||||
endif()
|
||||
file(READ ${file_name} current_file_contents)
|
||||
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
|
||||
string(REPLACE "\n" ";" current_file_contents ${current_file_contents})
|
||||
|
Loading…
Reference in New Issue
Block a user