瀏覽代碼

add command line option -m to allow multiple instances (temporarilly)

Le Tan 5 年之前
父節點
當前提交
28d62d2400
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. 12 1
      src/main.cpp

+ 12 - 1
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) {