From 1045cdb98e878e6ca0643c2a91ddaa11af4b00e3 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Thu, 8 Oct 2015 12:57:56 -0400 Subject: [PATCH] Remove MM:S dir from search paths. --- core/provider/provider_ep2.cpp | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/core/provider/provider_ep2.cpp b/core/provider/provider_ep2.cpp index 1f6b9c7..2b51b60 100644 --- a/core/provider/provider_ep2.cpp +++ b/core/provider/provider_ep2.cpp @@ -174,6 +174,41 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory, mm_LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION); } +#if SOURCE_ENGINE == SE_SOURCE2 + // Since we have to be added as a Game path (cannot add GameBin directly), we + // automatically get added to other paths as well, including having the MM:S + // dir become the default write path for logs and more. We can fix some of these. + + char searchPath[260]; + baseFs->GetSearchPath("GAME", (GetSearchPathTypes_t)0, searchPath, sizeof(searchPath)); + for (int i = 0; i < sizeof(searchPath); ++i) + { + if (searchPath[i] == ';') + { + searchPath[i] = '\0'; + break; + } + } + baseFs->RemoveSearchPath(searchPath, "GAME"); + + // TODO: figure out why these calls get ignored and path remains + //baseFs->RemoveSearchPath(searchPath, "CONTENT"); + //baseFs->RemoveSearchPath(searchPath, "SHADER_SOURCE"); + //baseFs->RemoveSearchPath(searchPath, "SHADER_SOURCE_MOD"); + + baseFs->RemoveSearchPaths("DEFAULT_WRITE_PATH"); + baseFs->GetSearchPath("GAME", (GetSearchPathTypes_t)0, searchPath, sizeof(searchPath)); + for (int i = 0; i < sizeof(searchPath); ++i) + { + if (searchPath[i] == ';') + { + searchPath[i] = '\0'; + break; + } + } + baseFs->AddSearchPath(searchPath, "DEFAULT_WRITE_PATH"); +#endif + #if SOURCE_ENGINE >= SE_ORANGEBOX g_pCVar = icvar; #endif