diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-08-02 23:51:23 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-08-02 23:51:23 -0700 |
commit | 6717bbff707373b3a5a08c3384ffd0f8496aee9a (patch) | |
tree | 5cd09fd624c97acbb188282570d626f1276bcbe7 /continuedev | |
parent | 4421a3e9c2098b5b2793449a03cdf390e81aa460 (diff) | |
download | sncontinue-6717bbff707373b3a5a08c3384ffd0f8496aee9a.tar.gz sncontinue-6717bbff707373b3a5a08c3384ffd0f8496aee9a.tar.bz2 sncontinue-6717bbff707373b3a5a08c3384ffd0f8496aee9a.zip |
default_config.py migration helper
Diffstat (limited to 'continuedev')
-rw-r--r-- | continuedev/src/continuedev/libs/util/paths.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/continuedev/src/continuedev/libs/util/paths.py b/continuedev/src/continuedev/libs/util/paths.py index a659f044..1e11898f 100644 --- a/continuedev/src/continuedev/libs/util/paths.py +++ b/continuedev/src/continuedev/libs/util/paths.py @@ -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 |