fix: preset directory issues (#494)

Written on github's editor, and not tested yet 😅 !
This commit is contained in:
David Lapshin 2022-09-23 23:08:55 +03:00 committed by GitHub
commit 67e9ba9672
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -190,6 +190,9 @@ class GradienceApplication(Adw.Application):
buglog("file")
# keep compatiblity with old presets
if repo.name.endswith(".json"):
if not os.path.isdir(os.path.join(PRESET_DIR, "user")):
os.mkdir(os.path.join(PRESET_DIR, "user"))
os.rename(repo, os.path.join(
PRESET_DIR, "user", repo.name))

View file

@ -62,12 +62,8 @@ class GradiencePresetWindow(Adw.Window):
custom_presets = {}
official_repositories = {
_(
"Official"
): "https://github.com/GradienceTeam/Community/raw/next/official.json",
_(
"Curated"
): "https://github.com/GradienceTeam/Community/raw/next/curated.json",
"Official": "https://github.com/GradienceTeam/Community/raw/next/official.json",
"Curated": "https://github.com/GradienceTeam/Community/raw/next/curated.json",
}
search_results_list = []
@ -343,6 +339,9 @@ class GradiencePresetWindow(Adw.Window):
buglog("file")
# keep compatiblity with old presets
if repo.name.endswith(".json"):
if not os.path.isdir(os.path.join(preset_directory, "user")):
os.mkdir(os.path.join(preset_directory, "user"))
os.rename(repo, os.path.join(
preset_directory, "user", repo.name))