common: load_localized_config() should make repo/ if not present

For 1,000,000 checks, this adds:
* ~4 seconds of runtime on a server with very slow disks.
* ~0.7 seconds of runtime on my laptop with a fast SSD.
This commit is contained in:
Hans-Christoph Steiner 2023-05-04 12:34:32 +02:00
parent 49362b5fd1
commit 74a23284e1

View file

@ -510,12 +510,12 @@ def load_localized_config(name, repodir):
if key not in lst[akey]: if key not in lst[akey]:
lst[akey][key] = {} lst[akey][key] = {}
if key == "icon": if key == "icon":
shutil.copy( icons_dir = os.path.join(repodir, 'icons')
os.path.join("config", value), if not os.path.exists(icons_dir):
os.path.join(repodir, "icons") os.mkdir(icons_dir)
) shutil.copy(os.path.join("config", value), icons_dir)
lst[akey][key][locale] = file_entry( lst[akey][key][locale] = file_entry(
os.path.join(repodir, "icons", value) os.path.join(icons_dir, value)
) )
else: else:
lst[akey][key][locale] = value lst[akey][key][locale] = value