Add support for Valve search paths to GetFileSize native (bug 5931, r=asherkin).
This commit is contained in:
@@ -51,7 +51,7 @@ using namespace SourceHook;
|
||||
* Add 1 to the RHS of this expression to bump the intercom file
|
||||
* This is to prevent mismatching core/logic binaries
|
||||
*/
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 26)
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 27)
|
||||
|
||||
#if defined SM_LOGIC
|
||||
class IVEngineServer
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
virtual char *ReadLine(char *pOutput, int maxChars, FileHandle_t file) = 0;
|
||||
virtual bool EndOfFile(FileHandle_t file) = 0;
|
||||
virtual bool FileExists(const char *pFileName, const char *pPathID = 0) = 0;
|
||||
virtual unsigned int Size(const char *pFileName, const char *pPathID = 0) = 0;
|
||||
};
|
||||
|
||||
namespace SourceMod
|
||||
|
||||
@@ -426,6 +426,18 @@ static cell_t sm_FileSize(IPluginContext *pContext, const cell_t *params)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (params[0] >= 2 && params[2] == 1)
|
||||
{
|
||||
if (smcore.filesystem->FileExists(name))
|
||||
{
|
||||
return smcore.filesystem->Size(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
char realpath[PLATFORM_MAX_PATH];
|
||||
g_pSM->BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
Reference in New Issue
Block a user