Allow to set commandline arguments on android

This commit is contained in:
Deve 2018-06-10 23:25:51 +02:00
parent e823babb90
commit 90f3a2389e
4 changed files with 24 additions and 1 deletions

View File

@ -994,6 +994,10 @@ namespace UserConfigParams
PARAM_PREFIX BoolUserConfigParam m_everything_unlocked
PARAM_DEFAULT( BoolUserConfigParam(false, "everything_unlocked",
"Enable all karts and tracks") );
PARAM_PREFIX StringUserConfigParam m_commandline
PARAM_DEFAULT( StringUserConfigParam("", "commandline",
"Allows to set commandline args in config file") );
// TODO? implement blacklist for new irrlicht device and GUI
PARAM_PREFIX std::vector<std::string> m_blacklist_res;

View File

@ -1737,6 +1737,8 @@ int main(int argc, char *argv[] )
// handle all command line options that do not need (or must
// not have) other managers initialised:
initUserConfig();
CommandLine::addArgsFromUserConfig();
handleCmdLinePreliminary();

View File

@ -32,12 +32,28 @@ std::string CommandLine::m_exec_name="";
void CommandLine::init(unsigned int argc, char *argv[])
{
if (argc > 0)
{
m_exec_name = argv[0];
}
for(unsigned int i=1; i<argc; i++)
for (unsigned int i = 1; i < argc; i++)
{
m_argv.push_back(argv[i]);
}
} // CommandLine
// ----------------------------------------------------------------------------
void CommandLine::addArgsFromUserConfig()
{
std::vector<std::string> config_args;
config_args = StringUtils::split(UserConfigParams::m_commandline, ' ');
for (std::string config_arg : config_args)
{
m_argv.push_back(config_arg);
}
}
// ----------------------------------------------------------------------------
bool CommandLine::has(const std::string &option)
{

View File

@ -79,6 +79,7 @@ private:
public:
static void init(unsigned int argc, char *argv[]);
static void addArgsFromUserConfig();
static void reportInvalidParameters();
static bool has(const std::string &option);
// ------------------------------------------------------------------------