diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index f5c08f0de..040509811 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -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 m_blacklist_res; diff --git a/src/main.cpp b/src/main.cpp index 1a26da448..048439e28 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(); diff --git a/src/utils/command_line.cpp b/src/utils/command_line.cpp index c68332326..df62a93ec 100644 --- a/src/utils/command_line.cpp +++ b/src/utils/command_line.cpp @@ -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 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) { diff --git a/src/utils/command_line.hpp b/src/utils/command_line.hpp index 84abc5de8..aae6d2400 100644 --- a/src/utils/command_line.hpp +++ b/src/utils/command_line.hpp @@ -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); // ------------------------------------------------------------------------