summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-07-18 02:24:44 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-03 11:39:01 -0500
commit5e528fb4cf16ae208944d15d568c9140e3d741e4 (patch)
tree8fd4927aeffb19406e2356d39c2bec0751c7f53d /src/main.cpp
parentb103f297752b170ee4ade6e0e9085c6d31c020ca (diff)
new CommandLine class
implemented crashdump as a command, fixed dump_running_process.bat to use it attach to console if present instead of always create one
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7130d15c..8a006907 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -49,6 +49,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "env.h"
#include "envmodule.h"
#include "shared/util.h"
+#include "commandline.h"
#include <eh.h>
#include "shared/windows_error.h"
@@ -811,22 +812,6 @@ int runApplication(
return 1;
}
-int doCoreDump(env::CoreDumpTypes type)
-{
- env::Console c;
-
- // dump
- const auto b = env::coredumpOther(type);
- if (!b) {
- std::wcerr << L"\n>>>> a minidump file was not written\n\n";
- }
-
- std::wcerr << L"Press enter to continue...";
- std::wcin.get();
-
- return (b ? 0 : 1);
-}
-
log::Levels convertQtLevel(QtMsgType t)
{
switch (t)
@@ -895,17 +880,11 @@ void initLogging()
int main(int argc, char *argv[])
{
TimeThis tt("main to runApplication()");
+ cl::CommandLine cl;
- // handle --crashdump first
- for (int i=1; i<argc; ++i) {
- if (std::strcmp(argv[i], "--crashdump") == 0) {
- return doCoreDump(env::CoreDumpTypes::Mini);
- } else if (std::strcmp(argv[i], "--crashdump-data") == 0) {
- return doCoreDump(env::CoreDumpTypes::Data);
- } else if (std::strcmp(argv[i], "--crashdump-full") == 0) {
- return doCoreDump(env::CoreDumpTypes::Full);
- }
- }
+ const auto r = cl.run(argc, argv);
+ if (r >= 0)
+ return r;
initLogging();