diff --git a/include/Startup.h b/include/Startup.h index 1303e00..4b64e4f 100644 --- a/include/Startup.h +++ b/include/Startup.h @@ -8,7 +8,6 @@ #pragma once #include void InitLauncher(int argc, char* argv[]); -void CheckDir(int argc,char* args[]); std::string GetEP(char*P = nullptr); std::string GetGamePath(); std::string GetVer(); diff --git a/src/Startup.cpp b/src/Startup.cpp index 1814f25..e9c4faa 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -128,45 +128,7 @@ void CheckForUpdates(int argc,char*args[],const std::string& CV){ }else info("Launcher version is up to date"); 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[]){ if(argc > 1){ std::string Port = argv[1]; @@ -189,6 +151,7 @@ void InitLauncher(int argc, char* argv[]) { Discord_Main(); //Dev = true; //RequestRole(); + CustomPort(argc, argv); CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch()); } diff --git a/src/main.cpp b/src/main.cpp index 8caad53..5de2f30 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,12 +25,12 @@ int main(int argc, char* argv[]) { std::thread th(flush); th.detach(); #endif + GetEP(argv[0]); InitLauncher(argc,argv); - //CheckDir(argc,argv); try { LegitimacyCheck(); - }catch (std::exception&e){ + }catch (std::exception& e){ fatal("Main 1 : " + std::string(e.what())); } PreGame(GetGameDir());