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