aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2023-07-24 23:28:00 +0200
committerDanielGavin <danielgavin5@hotmail.com>2023-07-24 23:28:00 +0200
commit261f4a2fc416fb29a32d1fabbf6d111d4c116518 (patch)
treed10625cd9411eaccf9d0df8997854c4d41bb655e /src/server
parent111bde405984d6a1b5eae4edd521e94010621079 (diff)
Remember to clean up collections when reloading them.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/requests.odin19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/server/requests.odin b/src/server/requests.odin
index 7193b9b..4174fa0 100644
--- a/src/server/requests.odin
+++ b/src/server/requests.odin
@@ -437,18 +437,31 @@ read_ols_initialize_options :: proc(
config.enable_fake_method =
ols_config.enable_fake_methods.(bool) or_else config.enable_fake_method
- // copy collections from new config
+ // copy collections from new config
when ODIN_OS == .Windows {
for it in ols_config.collections {
forward, _ := filepath.to_slash(
common.get_case_sensitive_path(it.path),
context.temp_allocator,
)
- config.collections[strings.clone(it.name, context.allocator)] = strings.clone(forward, context.allocator)
+
+ if it.name in config.collections {
+ delete(config.collections[it.name])
+ delete_key(&config.collections, it.name)
+ }
+
+ config.collections[strings.clone(it.name, context.allocator)] =
+ strings.clone(forward, context.allocator)
}
} else {
for it in ols_config.collections {
- config.collections[strings.clone(it.name, context.allocator)] = strings.clone(it.path, context.allocator)
+ if it.name in config.collections {
+ delete(config.collections[it.name])
+ delete_key(&config.collections, it.name)
+ }
+
+ config.collections[strings.clone(it.name, context.allocator)] =
+ strings.clone(it.path, context.allocator)
}
}