diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2023-07-24 23:28:00 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2023-07-24 23:28:00 +0200 |
| commit | 261f4a2fc416fb29a32d1fabbf6d111d4c116518 (patch) | |
| tree | d10625cd9411eaccf9d0df8997854c4d41bb655e /src/server | |
| parent | 111bde405984d6a1b5eae4edd521e94010621079 (diff) | |
Remember to clean up collections when reloading them.
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/requests.odin | 19 |
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) } } |