mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Use filesystem paths for -f command line param
This commit is contained in:
parent
0b5dcdc478
commit
0b1842d438
|
@ -3,6 +3,7 @@
|
||||||
#ifndef ENGINE_CONSOLE_H
|
#ifndef ENGINE_CONSOLE_H
|
||||||
#define ENGINE_CONSOLE_H
|
#define ENGINE_CONSOLE_H
|
||||||
|
|
||||||
|
#include <engine/storage.h>
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
|
||||||
class IConsole : public IInterface
|
class IConsole : public IInterface
|
||||||
|
@ -90,7 +91,7 @@ public:
|
||||||
virtual void ExecuteLine(const char *Sptr, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
virtual void ExecuteLine(const char *Sptr, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||||
virtual void ExecuteLineFlag(const char *Sptr, int FlasgMask, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
virtual void ExecuteLineFlag(const char *Sptr, int FlasgMask, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||||
virtual void ExecuteLineStroked(int Stroke, const char *pStr, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
virtual void ExecuteLineStroked(int Stroke, const char *pStr, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||||
virtual void ExecuteFile(const char *pFilename, int ClientID = -1, bool LogFailure = false) = 0;
|
virtual void ExecuteFile(const char *pFilename, int ClientID = -1, bool LogFailure = false, int StorageType = IStorage::TYPE_ALL) = 0;
|
||||||
|
|
||||||
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData) = 0;
|
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData) = 0;
|
||||||
virtual void SetPrintOutputLevel(int Index, int OutputLevel) = 0;
|
virtual void SetPrintOutputLevel(int Index, int OutputLevel) = 0;
|
||||||
|
|
|
@ -493,7 +493,7 @@ void CConsole::ExecuteLineFlag(const char *pStr, int FlagMask, int ClientID, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CConsole::ExecuteFile(const char *pFilename, int ClientID, bool LogFailure)
|
void CConsole::ExecuteFile(const char *pFilename, int ClientID, bool LogFailure, int StorageType)
|
||||||
{
|
{
|
||||||
// make sure that this isn't being executed already
|
// make sure that this isn't being executed already
|
||||||
for(CExecFile *pCur = m_pFirstExec; pCur; pCur = pCur->m_pPrev)
|
for(CExecFile *pCur = m_pFirstExec; pCur; pCur = pCur->m_pPrev)
|
||||||
|
@ -513,7 +513,7 @@ void CConsole::ExecuteFile(const char *pFilename, int ClientID, bool LogFailure)
|
||||||
m_pFirstExec = &ThisFile;
|
m_pFirstExec = &ThisFile;
|
||||||
|
|
||||||
// exec the file
|
// exec the file
|
||||||
IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
|
IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, StorageType);
|
||||||
|
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
if(File)
|
if(File)
|
||||||
|
@ -546,7 +546,7 @@ void CConsole::Con_Echo(IResult *pResult, void *pUserData)
|
||||||
|
|
||||||
void CConsole::Con_Exec(IResult *pResult, void *pUserData)
|
void CConsole::Con_Exec(IResult *pResult, void *pUserData)
|
||||||
{
|
{
|
||||||
((CConsole*)pUserData)->ExecuteFile(pResult->GetString(0), -1, true);
|
((CConsole*)pUserData)->ExecuteFile(pResult->GetString(0), -1, true, IStorage::TYPE_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConsole::ConCommandAccess(IResult *pResult, void *pUser)
|
void CConsole::ConCommandAccess(IResult *pResult, void *pUser)
|
||||||
|
@ -864,7 +864,7 @@ void CConsole::ParseArguments(int NumArgs, const char **ppArguments)
|
||||||
if(ppArguments[i][0] == '-' && ppArguments[i][1] == 'f' && ppArguments[i][2] == 0)
|
if(ppArguments[i][0] == '-' && ppArguments[i][1] == 'f' && ppArguments[i][2] == 0)
|
||||||
{
|
{
|
||||||
if(NumArgs - i > 1)
|
if(NumArgs - i > 1)
|
||||||
ExecuteFile(ppArguments[i+1], -1, true);
|
ExecuteFile(ppArguments[i+1], -1, true, IStorage::TYPE_ABSOLUTE);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else if(!str_comp("-s", ppArguments[i]) || !str_comp("--silent", ppArguments[i]))
|
else if(!str_comp("-s", ppArguments[i]) || !str_comp("--silent", ppArguments[i]))
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#define ENGINE_SHARED_CONSOLE_H
|
#define ENGINE_SHARED_CONSOLE_H
|
||||||
|
|
||||||
#include <engine/console.h>
|
#include <engine/console.h>
|
||||||
|
#include <engine/storage.h>
|
||||||
#include <base/math.h>
|
#include <base/math.h>
|
||||||
#include "memheap.h"
|
#include "memheap.h"
|
||||||
|
|
||||||
|
@ -197,7 +198,7 @@ public:
|
||||||
virtual bool LineIsValid(const char *pStr);
|
virtual bool LineIsValid(const char *pStr);
|
||||||
virtual void ExecuteLine(const char *pStr, int ClientID = -1, bool InterpretSemicolons = true);
|
virtual void ExecuteLine(const char *pStr, int ClientID = -1, bool InterpretSemicolons = true);
|
||||||
virtual void ExecuteLineFlag(const char *pStr, int FlagMask, int ClientID = -1, bool InterpretSemicolons = true);
|
virtual void ExecuteLineFlag(const char *pStr, int FlagMask, int ClientID = -1, bool InterpretSemicolons = true);
|
||||||
virtual void ExecuteFile(const char *pFilename, int ClientID = -1, bool LogFailure = false);
|
virtual void ExecuteFile(const char *pFilename, int ClientID = -1, bool LogFailure = false, int StorageType = IStorage::TYPE_ALL);
|
||||||
|
|
||||||
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData);
|
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData);
|
||||||
virtual void SetPrintOutputLevel(int Index, int OutputLevel);
|
virtual void SetPrintOutputLevel(int Index, int OutputLevel);
|
||||||
|
|
Loading…
Reference in a new issue