mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Encode ALL files to utf8
This commit is contained in:
parent
65400f3fb5
commit
01f2fb682a
|
@ -196,7 +196,7 @@ def yes_no(answer):
|
||||||
print("Welcome in RcGcDw config builder! This script is still work in progress so beware! You can accept the default value if provided in the question by using Enter key without providing any other input.\nWARNING! Your current settings.json will be overwritten if you continue!")
|
print("Welcome in RcGcDw config builder! This script is still work in progress so beware! You can accept the default value if provided in the question by using Enter key without providing any other input.\nWARNING! Your current settings.json will be overwritten if you continue!")
|
||||||
|
|
||||||
try: # load settings
|
try: # load settings
|
||||||
with open("../settings.json.example") as sfile:
|
with open("../settings.json.example", encoding="utf-8") as sfile:
|
||||||
settings = json.load(sfile)
|
settings = json.load(sfile)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
if yes_no(default_or_custom(input("Template config (settings.json.example) could not be found. Download the most recent stable one from master branch? (https://gitlab.com/piotrex43/RcGcDw/raw/master/settings.json.example)? (Y/n)"), "y")):
|
if yes_no(default_or_custom(input("Template config (settings.json.example) could not be found. Download the most recent stable one from master branch? (https://gitlab.com/piotrex43/RcGcDw/raw/master/settings.json.example)? (Y/n)"), "y")):
|
||||||
|
@ -468,7 +468,7 @@ class AdvancedSettings:
|
||||||
try:
|
try:
|
||||||
BasicSettings()
|
BasicSettings()
|
||||||
shutil.copy("settings.json", "settings.json.bak")
|
shutil.copy("settings.json", "settings.json.bak")
|
||||||
with open("settings.json", "w") as settings_file:
|
with open("settings.json", "w", encoding="utf-8") as settings_file:
|
||||||
settings_file.write(json.dumps(settings, indent=4))
|
settings_file.write(json.dumps(settings, indent=4))
|
||||||
if "--advanced" in sys.argv:
|
if "--advanced" in sys.argv:
|
||||||
print("Basic part of the config has been completed. Starting the advanced part...")
|
print("Basic part of the config has been completed. Starting the advanced part...")
|
||||||
|
@ -478,5 +478,5 @@ except KeyboardInterrupt:
|
||||||
if not yes_no(default_or_custom(input("\nSave the config before exiting? (y/N)"),"n")):
|
if not yes_no(default_or_custom(input("\nSave the config before exiting? (y/N)"),"n")):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
with open("settings.json", "w") as settings_file:
|
with open("settings.json", "w", encoding="utf-8") as settings_file:
|
||||||
settings_file.write(json.dumps(settings, indent=4))
|
settings_file.write(json.dumps(settings, indent=4))
|
|
@ -35,7 +35,7 @@ def run():
|
||||||
logger.exception("Failed to migrate appearance embed.")
|
logger.exception("Failed to migrate appearance embed.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
shutil.copy("settings.json", "settings.json.{}.bak".format(int(time.time())))
|
shutil.copy("settings.json", "settings.json.{}.bak".format(int(time.time())))
|
||||||
with open("settings.json", "w") as new_write:
|
with open("settings.json", "w", encoding="utf-8") as new_write:
|
||||||
new_write.write(json.dumps(new_settings, indent=4))
|
new_write.write(json.dumps(new_settings, indent=4))
|
||||||
load_settings()
|
load_settings()
|
||||||
logger.info("Migration 1.13.1.1 has been successful.")
|
logger.info("Migration 1.13.1.1 has been successful.")
|
||||||
|
|
|
@ -9,7 +9,7 @@ def return_example_file(force=False) -> dict:
|
||||||
try:
|
try:
|
||||||
if force:
|
if force:
|
||||||
raise FileNotFoundError
|
raise FileNotFoundError
|
||||||
with open('settings.json.example', 'r') as example_file:
|
with open('settings.json.example', 'r', encoding="utf-8") as example_file:
|
||||||
return json.loads(example_file.read())
|
return json.loads(example_file.read())
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -52,7 +52,7 @@ storage = datafile
|
||||||
# Remove previous data holding file if exists and limitfetch allows
|
# Remove previous data holding file if exists and limitfetch allows
|
||||||
|
|
||||||
if settings["limitrefetch"] != -1 and os.path.exists("lastchange.txt") is True:
|
if settings["limitrefetch"] != -1 and os.path.exists("lastchange.txt") is True:
|
||||||
with open("lastchange.txt", 'r') as sfile:
|
with open("lastchange.txt", 'r', encoding="utf-8") as sfile:
|
||||||
logger.info("Converting old lastchange.txt file into new data storage data.json...")
|
logger.info("Converting old lastchange.txt file into new data storage data.json...")
|
||||||
storage["rcid"] = int(sfile.read().strip())
|
storage["rcid"] = int(sfile.read().strip())
|
||||||
datafile.save_datafile()
|
datafile.save_datafile()
|
||||||
|
|
Loading…
Reference in a new issue