import os
# ask the user for the old and new values
oldValue =input("Enter the old value: ")
newValue =input("Enter the new value: ")
basePath ="/opt/genshin-server/"# ask the user for the list of files
files = basePath +"genshin/srv/nodeserver/conf/nodeserver.xml,"+ basePath +"genshin/srv/gateserver/conf/gateserver.xml,"+ basePath +"genshin/srv/dbgate/conf/dbgate.xml,"+ basePath +"genshin/srv/dispatch/conf/dispatch.xml,"+ basePath +"genshin/srv/gameserver/conf/gameserver.xml,"+ basePath +"genshin/srv/muipserver/conf/muipserver.xml,"+ basePath +"genshin/srv/oaserver/conf/oaserver.xml,"+ basePath +"genshin/srv/pathfindingserver/conf/pathfindingserver.xml,"+ basePath +"genshin/srv/multiserver/conf/multiserver.xml,"+ basePath +"genshin/srv/tothemoonserver/conf/tothemoonserver.xml,"+ basePath +"genshin/srv/sdkserver/config.json"# split the list of files into a list of filenames
filenames = files.split(",")# iterate over the list of filenamesfor filename in filenames:# check if the file exists and is readableif os.path.isfile(filename)and os.access(filename, os.R_OK):# open the file in read-only modewithopen(filename,'r')as f:# read the file content
content = f.read()# replace the old value with the new value
content = content.replace(oldValue, newValue)# open the file in write-only modewithopen(filename,'w')as f:# write the new content to the file
f.write(content)# print a confirmation messageprint(f"The file '{filename}' was successfully updated.")else:# print an error messageprint(f"Error: the file '{filename}' does not exist or is not readable.")