mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-13 09:35:37 +00:00
bugfix: All previous entity files are removed when file is updated
This commit is contained in:
@@ -150,6 +150,8 @@ func loadEntityFileYaml(filename string, entityname string) {
|
||||
func updateEvmFromFile(entityname string, data []map[string]string) {
|
||||
count := len(data)
|
||||
|
||||
sv.RemoveKeysThatStartWith("entities." + entityname)
|
||||
|
||||
sv.Contents["entities."+entityname+".count"] = fmt.Sprintf("%v", count)
|
||||
|
||||
for i, mapp := range data {
|
||||
|
||||
@@ -27,3 +27,11 @@ func ReplaceEntityVars(prefix string, source string) string {
|
||||
|
||||
return source
|
||||
}
|
||||
|
||||
func RemoveKeysThatStartWith(search string) {
|
||||
for k, _ := range Contents {
|
||||
if strings.HasPrefix(k, search) {
|
||||
delete(Contents, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user