From 261f4a2fc416fb29a32d1fabbf6d111d4c116518 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Mon, 24 Jul 2023 23:28:00 +0200 Subject: Remember to clean up collections when reloading them. --- src/server/requests.odin | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') 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) } } -- cgit v1.2.3