mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
Fix relaunch
This commit is contained in:
parent
47681cda50
commit
5bdd8c11da
@ -11,6 +11,8 @@ struct Options {
|
||||
bool no_launch = false;
|
||||
char **game_arguments = nullptr;
|
||||
int game_arguments_length = 0;
|
||||
char** argv = nullptr;
|
||||
int argc = 0;
|
||||
};
|
||||
|
||||
void InitOptions(int argc, char *argv[], Options &options);
|
||||
|
@ -6,6 +6,9 @@
|
||||
void InitOptions(int argc, char *argv[], Options &options) {
|
||||
int i = 1;
|
||||
|
||||
options.argc = argc;
|
||||
options.argv = argv;
|
||||
|
||||
if (argc > 2)
|
||||
if (std::string(argv[1]) == "0" && std::string(argv[2]) == "0") {
|
||||
options.verbose = true;
|
||||
|
@ -97,9 +97,9 @@ std::string GetEP(char* P) {
|
||||
#if defined(_WIN32)
|
||||
void ReLaunch() {
|
||||
std::string Arg;
|
||||
for (int c = 0; c <= options.game_arguments_length; c++) {
|
||||
for (int c = 2; c <= options.argc; c++) {
|
||||
Arg += options.argv[c - 1];
|
||||
Arg += " ";
|
||||
Arg += options.game_arguments[c - 1];
|
||||
}
|
||||
info("Relaunch!");
|
||||
system("cls");
|
||||
@ -110,9 +110,9 @@ void ReLaunch() {
|
||||
}
|
||||
void URelaunch() {
|
||||
std::string Arg;
|
||||
for (int c = 0; c <= options.game_arguments_length; c++) {
|
||||
for (int c = 2; c <= options.argc; c++) {
|
||||
Arg += options.argv[c - 1];
|
||||
Arg += " ";
|
||||
Arg += options.game_arguments[c - 1];
|
||||
}
|
||||
ShellExecute(nullptr, "open", (GetEP() + GetEN()).c_str(), Arg.c_str(), nullptr, SW_SHOWNORMAL);
|
||||
ShowWindow(GetConsoleWindow(), 0);
|
||||
@ -122,9 +122,9 @@ void URelaunch() {
|
||||
#elif defined(__linux__)
|
||||
void ReLaunch() {
|
||||
std::string Arg;
|
||||
for (int c = 0; c <= options.game_arguments_length; c++) {
|
||||
for (int c = 2; c <= options.argc; c++) {
|
||||
Arg += options.argv[c - 1];
|
||||
Arg += " ";
|
||||
Arg += options.game_arguments[c - 1];
|
||||
}
|
||||
info("Relaunch!");
|
||||
system("clear");
|
||||
@ -134,9 +134,9 @@ void ReLaunch() {
|
||||
}
|
||||
void URelaunch() {
|
||||
std::string Arg;
|
||||
for (int c = 0; c <= options.game_arguments_length; c++) {
|
||||
for (int c = 2; c <= options.argc; c++) {
|
||||
Arg += options.argv[c - 1];
|
||||
Arg += " ";
|
||||
Arg += options.game_arguments[c - 1];
|
||||
}
|
||||
execl((GetEP() + GetEN()).c_str(), Arg.c_str(), NULL);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user