default_config.py migration helper

This commit is contained in:
Nate Sesti 2023-08-02 23:51:23 -07:00
parent 4421a3e9c2
commit 6717bbff70

View file

@ -36,9 +36,16 @@ def getConfigFilePath() -> str:
path = os.path.join(getGlobalFolderPath(), "config.py")
os.makedirs(os.path.dirname(path), exist_ok=True)
if not os.path.exists(path):
with open(path, 'r') as f:
existing_content = f.read()
if not os.path.exists(path) or existing_content.strip() == "":
with open(path, 'w') as f:
f.write(default_config)
elif " continuedev.core" in existing_content:
with open(path, 'w') as f:
f.write(existing_content.replace(" continuedev.",
" continuedev.src.continuedev."))
return path