Skip to content

Commit

Permalink
Merge pull request entropy-zero#274 from Blixibon/mapbase/feature/dot…
Browse files Browse the repository at this point in the history
…-slash-command-line-param

Command line parameter to support dot slashes in VScript file read calls
  • Loading branch information
Blixibon authored Feb 4, 2024
2 parents 782053e + a96147a commit 11533fa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sp/src/game/shared/mapbase/vscript_singletons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "filesystem.h"
#include "igameevents.h"
#include "engine/ivdebugoverlay.h"
#include "icommandline.h"

#ifdef CLIENT_DLL
#include "IEffects.h"
Expand Down Expand Up @@ -1094,7 +1095,7 @@ const char *CScriptReadWriteFile::FileRead( const char *szFile )
char pszFullName[MAX_PATH];
V_snprintf( pszFullName, sizeof(pszFullName), SCRIPT_RW_FULL_PATH_FMT, szFile );

if ( !V_RemoveDotSlashes( pszFullName, CORRECT_PATH_SEPARATOR, true ) )
if ( !CommandLine()->FindParm( "-script_dotslash_read" ) && !V_RemoveDotSlashes( pszFullName, CORRECT_PATH_SEPARATOR, true ) )
{
DevWarning( 2, "Invalid file location : %s\n", szFile );
return NULL;
Expand Down Expand Up @@ -1143,7 +1144,7 @@ bool CScriptReadWriteFile::FileExists( const char *szFile )
char pszFullName[MAX_PATH];
V_snprintf( pszFullName, sizeof(pszFullName), SCRIPT_RW_FULL_PATH_FMT, szFile );

if ( !V_RemoveDotSlashes( pszFullName, CORRECT_PATH_SEPARATOR, true ) )
if ( !CommandLine()->FindParm( "-script_dotslash_read" ) && !V_RemoveDotSlashes( pszFullName, CORRECT_PATH_SEPARATOR, true ) )
{
DevWarning( 2, "Invalid file location : %s\n", szFile );
return NULL;
Expand Down Expand Up @@ -1224,7 +1225,7 @@ HSCRIPT CScriptReadWriteFile::KeyValuesRead( const char *szFile )
char pszFullName[MAX_PATH];
V_snprintf( pszFullName, sizeof(pszFullName), SCRIPT_RW_FULL_PATH_FMT, szFile );

if ( !V_RemoveDotSlashes( pszFullName, CORRECT_PATH_SEPARATOR, true ) )
if ( !CommandLine()->FindParm( "-script_dotslash_read" ) && !V_RemoveDotSlashes( pszFullName, CORRECT_PATH_SEPARATOR, true ) )
{
DevWarning( 2, "Invalid file location : %s\n", szFile );
return NULL;
Expand Down

0 comments on commit 11533fa

Please sign in to comment.