From 28d62d24006da571173d1f71a59d2397ffb45a2e Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sat, 14 Dec 2019 10:50:02 +0800 Subject: [PATCH] add command line option -m to allow multiple instances (temporarilly) --- src/main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 0e37615f..9d3ea90c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,8 +120,19 @@ void VLogger(QtMsgType type, const QMessageLogContext &context, const QString &m int main(int argc, char *argv[]) { + bool allowMultiInstances = false; + for (int i = 1; i < argc; ++i) { + if (!qstrcmp(argv[i], "-m")) { + allowMultiInstances = true; + break; + } + } + VSingleInstanceGuard guard; - bool canRun = guard.tryRun(); + bool canRun = true; + if (!allowMultiInstances) { + canRun = guard.tryRun(); + } QTextCodec *codec = QTextCodec::codecForName("UTF8"); if (codec) {