Browse Source

avoid reloading server's filesystem stuff

Andrey Filipenkov 3 years ago
parent
commit
0503993b8d
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lib/filesystem/Filesystem.cpp

+ 4 - 1
lib/filesystem/Filesystem.cpp

@@ -172,8 +172,11 @@ void CResourceHandler::initialize()
 	//    |-saves
 	//    |-config
 
+	// when built as single process, server can be started multiple times
+	if (globalResourceHandler.rootLoader)
+		return;
+
 	globalResourceHandler.rootLoader = vstd::make_unique<CFilesystemList>();
-    knownLoaders.clear();
 	knownLoaders["root"] = globalResourceHandler.rootLoader.get();
 	knownLoaders["saves"] = new CFilesystemLoader("SAVES/", VCMIDirs::get().userSavePath());
 	knownLoaders["config"] = new CFilesystemLoader("CONFIG/", VCMIDirs::get().userConfigPath());