Skip to content

Commit a5ef94f

Browse files
authored
Merge pull request #895 from Kitsune44/fix01
Fixes: CRD_PNG_Texture::CleanLocalCachedTextures.
2 parents f7e6569 + f2a5092 commit a5ef94f

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

src/game/client/swarm/rd_png_texture.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <vgui/ISurface.h>
77
#include "vpklib/packedstore.h"
88
#include "fmtstr.h"
9+
#include "tier2/fileutils.h"
910

1011
// memdbgon must be the last include file in a .cpp file!!!
1112
#include "tier0/memdbgon.h"
@@ -90,29 +91,19 @@ void CRD_PNG_Texture::CleanLocalCachedTextures(const char* szDirectory)
9091
if (CommandLine()->FindParm("-override_vpk"))
9192
return;
9293

93-
static char szGameRootPath[MAX_PATH];
94-
static bool bPathInitialized = false;
94+
static char pak01Path[ MAX_PATH ];
95+
static char pak02Path[ MAX_PATH ];
96+
static bool bPathsInitialized = false;
9597

96-
if (!bPathInitialized)
98+
if ( !bPathsInitialized )
9799
{
98-
const char* szGameInfoPath = "gameinfo.txt";
99-
if (g_pFullFileSystem->FileExists(szGameInfoPath, "MOD"))
100-
{
101-
char szFullPath[MAX_PATH];
102-
g_pFullFileSystem->RelativePathToFullPath(szGameInfoPath, "MOD", szFullPath, sizeof(szFullPath));
103-
V_ExtractFilePath(szFullPath, szGameRootPath, sizeof(szGameRootPath));
104-
V_FixSlashes(szGameRootPath);
105-
V_AppendSlash(szGameRootPath, sizeof(szGameRootPath));
106-
bPathInitialized = true;
107-
}
108-
else
109-
{
110-
return;
111-
}
100+
GetModSubdirectory( "pak01", pak01Path, sizeof( pak01Path ) );
101+
GetModSubdirectory( "pak02", pak02Path, sizeof( pak02Path ) );
102+
bPathsInitialized = true;
112103
}
113104

114-
static CPackedStore s_pak01(CFmtStr("%spak01", szGameRootPath), g_pFullFileSystem);
115-
static CPackedStore s_pak02(CFmtStr("%spak02", szGameRootPath), g_pFullFileSystem);
105+
static CPackedStore s_pak01( pak01Path, g_pFullFileSystem );
106+
static CPackedStore s_pak02( pak02Path, g_pFullFileSystem );
116107

117108
struct CleanupRule {
118109
std::initializer_list<const char*> extensions;

0 commit comments

Comments
 (0)