mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 17:58:45 +02:00
fix(icons): list icon logic
This commit is contained in:
@@ -93,7 +93,7 @@ func (k IconKey) SourceRef() (IconSource, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func InitIconListCache() {
|
func InitIconListCache() {
|
||||||
m := iconsCache.Load()
|
m := make(IconMap)
|
||||||
err := serialization.LoadJSONIfExist(common.IconListCachePath, &m)
|
err := serialization.LoadJSONIfExist(common.IconListCachePath, &m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// backward compatible
|
// backward compatible
|
||||||
@@ -119,8 +119,11 @@ func InitIconListCache() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iconsCache.Store(m)
|
||||||
|
|
||||||
task.OnProgramExit("save_icons_cache", func() {
|
task.OnProgramExit("save_icons_cache", func() {
|
||||||
_ = serialization.SaveJSON(common.IconListCachePath, &m, 0o644)
|
icons := iconsCache.Load()
|
||||||
|
_ = serialization.SaveJSON(common.IconListCachePath, &icons, 0o644)
|
||||||
})
|
})
|
||||||
|
|
||||||
go backgroundUpdateIcons()
|
go backgroundUpdateIcons()
|
||||||
|
|||||||
Reference in New Issue
Block a user