mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
Cleanup
This commit is contained in:
parent
ba5ba4b8b4
commit
d96f968dde
@ -8,7 +8,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
void InitLauncher(int argc, char* argv[]);
|
void InitLauncher(int argc, char* argv[]);
|
||||||
void CheckDir(int argc,char* args[]);
|
|
||||||
std::string GetEP(char*P = nullptr);
|
std::string GetEP(char*P = nullptr);
|
||||||
std::string GetGamePath();
|
std::string GetGamePath();
|
||||||
std::string GetVer();
|
std::string GetVer();
|
||||||
|
@ -128,45 +128,7 @@ void CheckForUpdates(int argc,char*args[],const std::string& CV){
|
|||||||
}else info("Launcher version is up to date");
|
}else info("Launcher version is up to date");
|
||||||
TraceBack++;
|
TraceBack++;
|
||||||
}
|
}
|
||||||
void CheckDir(int argc,char*args[]){
|
|
||||||
/*std::string CDir = args[0];
|
|
||||||
std::string MDir = "BeamNG\\mods";
|
|
||||||
if(!fs::is_directory("BeamNG")){
|
|
||||||
if(!fs::create_directory("BeamNG")){
|
|
||||||
error("Cannot Create BeamNG Directory! Retrying...");
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
|
||||||
ReLaunch(argc,args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(fs::is_directory(MDir) && !Dev){
|
|
||||||
int c = 0;
|
|
||||||
for (auto& p : fs::directory_iterator(MDir))c++;
|
|
||||||
if(c > 2) {
|
|
||||||
warn(std::to_string(c-1) + " local launcher mods will be wiped! Close this window if you don't want that!");
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(15));
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
fs::remove_all(MDir);
|
|
||||||
} catch (...) {
|
|
||||||
error("Please close the game and try again");
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(fs::is_directory(MDir) && !Dev)ReLaunch(argc,args);
|
|
||||||
if(!fs::create_directory(MDir) && !Dev){
|
|
||||||
error("Cannot Create Mods Directory! Retrying...");
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
|
||||||
ReLaunch(argc,args);
|
|
||||||
}
|
|
||||||
if(!fs::is_directory("BeamNG\\settings")){
|
|
||||||
if(!fs::create_directory("BeamNG\\settings")){
|
|
||||||
error("Cannot Create Settings Directory! Retrying...");
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
|
||||||
ReLaunch(argc,args);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
void CustomPort(int argc, char* argv[]){
|
void CustomPort(int argc, char* argv[]){
|
||||||
if(argc > 1){
|
if(argc > 1){
|
||||||
std::string Port = argv[1];
|
std::string Port = argv[1];
|
||||||
@ -189,6 +151,7 @@ void InitLauncher(int argc, char* argv[]) {
|
|||||||
Discord_Main();
|
Discord_Main();
|
||||||
//Dev = true;
|
//Dev = true;
|
||||||
//RequestRole();
|
//RequestRole();
|
||||||
|
|
||||||
CustomPort(argc, argv);
|
CustomPort(argc, argv);
|
||||||
CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch());
|
CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch());
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,12 @@ int main(int argc, char* argv[]) {
|
|||||||
std::thread th(flush);
|
std::thread th(flush);
|
||||||
th.detach();
|
th.detach();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GetEP(argv[0]);
|
GetEP(argv[0]);
|
||||||
InitLauncher(argc,argv);
|
InitLauncher(argc,argv);
|
||||||
//CheckDir(argc,argv);
|
|
||||||
try {
|
try {
|
||||||
LegitimacyCheck();
|
LegitimacyCheck();
|
||||||
}catch (std::exception&e){
|
}catch (std::exception& e){
|
||||||
fatal("Main 1 : " + std::string(e.what()));
|
fatal("Main 1 : " + std::string(e.what()));
|
||||||
}
|
}
|
||||||
PreGame(GetGameDir());
|
PreGame(GetGameDir());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user