From a08a693bf3b31f3755e092162eb321b3c7dffe3b Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Fri, 14 Aug 2015 07:52:50 -0400 Subject: [PATCH 1/2] Make path id default to "GAME" instead of NULL for FileExists and FileSize if param missing. This only affects plugins compiled before the param existed in the includes. NULL defaults to "GAME" on some engine versions, but is invalid on others, causing any file to not be found. --- core/logic/smn_filesystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/logic/smn_filesystem.cpp b/core/logic/smn_filesystem.cpp index 6581f2e9..91785048 100644 --- a/core/logic/smn_filesystem.cpp +++ b/core/logic/smn_filesystem.cpp @@ -551,7 +551,7 @@ static cell_t sm_FileExists(IPluginContext *pContext, const cell_t *params) if (params[0] >= 2 && params[2] == 1) { - char *pathID = NULL; + char *pathID = "GAME"; if (params[0] >= 3) pContext->LocalToStringNULL(params[3], &pathID); @@ -664,7 +664,7 @@ static cell_t sm_FileSize(IPluginContext *pContext, const cell_t *params) if (params[0] >= 2 && params[2] == 1) { - char *pathID = NULL; + char *pathID = "GAME"; if (params[0] >= 3) pContext->LocalToStringNULL(params[3], &pathID); From af4573e7af453897303386a7cd835c2ca3a511b2 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Fri, 14 Aug 2015 08:31:52 -0400 Subject: [PATCH 2/2] Fix build on Clang. --- core/logic/smn_filesystem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/logic/smn_filesystem.cpp b/core/logic/smn_filesystem.cpp index 91785048..c499b2af 100644 --- a/core/logic/smn_filesystem.cpp +++ b/core/logic/smn_filesystem.cpp @@ -551,7 +551,8 @@ static cell_t sm_FileExists(IPluginContext *pContext, const cell_t *params) if (params[0] >= 2 && params[2] == 1) { - char *pathID = "GAME"; + static char szDefaultPath[] = "GAME"; + char *pathID = szDefaultPath; if (params[0] >= 3) pContext->LocalToStringNULL(params[3], &pathID); @@ -664,7 +665,8 @@ static cell_t sm_FileSize(IPluginContext *pContext, const cell_t *params) if (params[0] >= 2 && params[2] == 1) { - char *pathID = "GAME"; + static char szDefaultPath[] = "GAME"; + char *pathID = szDefaultPath; if (params[0] >= 3) pContext->LocalToStringNULL(params[3], &pathID);