mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 15:36:10 +00:00
Ixmplement game arguments for linux
This commit is contained in:
parent
0c53ff4cd4
commit
afac729505
@ -107,13 +107,19 @@ void StartGame(std::string Dir) {
|
||||
void StartGame(std::string Dir) {
|
||||
int status;
|
||||
std::string filename = (Dir + "/BinLinux/BeamNG.drive.x64");
|
||||
char* argv[] = { filename.data(), NULL };
|
||||
std::vector<char*> argv;
|
||||
argv.push_back(filename.data());
|
||||
for (int i = 0; i < options.game_arguments_length; i++) {
|
||||
argv.push_back(options.game_arguments[i]);
|
||||
}
|
||||
|
||||
argv.push_back(nullptr);
|
||||
pid_t pid;
|
||||
posix_spawn_file_actions_t spawn_actions;
|
||||
posix_spawn_file_actions_init(&spawn_actions);
|
||||
posix_spawn_file_actions_addclose(&spawn_actions, STDOUT_FILENO);
|
||||
posix_spawn_file_actions_addclose(&spawn_actions, STDERR_FILENO);
|
||||
int result = posix_spawn(&pid, filename.c_str(), &spawn_actions, nullptr, argv, environ);
|
||||
int result = posix_spawn(&pid, filename.c_str(), &spawn_actions, nullptr, argv.data(), environ);
|
||||
|
||||
if (result != 0) {
|
||||
error("Failed to Launch the game! launcher closing soon");
|
||||
|
Loading…
x
Reference in New Issue
Block a user