|
|
@@ -1366,33 +1366,32 @@ static int run_program(fstream &logFile, int argc, char *argv[])
|
|
|
|
|
|
OBSApp program(argc, argv, profilerNameStore.get());
|
|
|
try {
|
|
|
- program.AppInit();
|
|
|
-
|
|
|
- OBSTranslator translator;
|
|
|
+ bool created_log = false;
|
|
|
|
|
|
- create_log_file(logFile);
|
|
|
+ program.AppInit();
|
|
|
delete_oldest_file(false, "obs-studio/profiler_data");
|
|
|
|
|
|
+ OBSTranslator translator;
|
|
|
program.installTranslator(&translator);
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
/* --------------------------------------- */
|
|
|
/* check and warn if already running */
|
|
|
|
|
|
+ bool cancel_launch = false;
|
|
|
bool already_running = false;
|
|
|
RunOnceMutex rom = GetRunOnceMutex(already_running);
|
|
|
|
|
|
- if (already_running && !multi) {
|
|
|
- blog(LOG_WARNING, "\n================================");
|
|
|
- blog(LOG_WARNING, "Warning: OBS is already running!");
|
|
|
- blog(LOG_WARNING, "================================\n");
|
|
|
+ if (!already_running) {
|
|
|
+ goto run;
|
|
|
+ }
|
|
|
|
|
|
+ if (!multi) {
|
|
|
QMessageBox::StandardButtons buttons(
|
|
|
QMessageBox::Yes | QMessageBox::Cancel);
|
|
|
QMessageBox mb(QMessageBox::Question,
|
|
|
QTStr("AlreadyRunning.Title"),
|
|
|
- QTStr("AlreadyRunning.Text"),
|
|
|
- buttons,
|
|
|
+ QTStr("AlreadyRunning.Text"), buttons,
|
|
|
nullptr);
|
|
|
mb.setButtonText(QMessageBox::Yes,
|
|
|
QTStr("AlreadyRunning.LaunchAnyway"));
|
|
|
@@ -1401,23 +1400,37 @@ static int run_program(fstream &logFile, int argc, char *argv[])
|
|
|
|
|
|
QMessageBox::StandardButton button;
|
|
|
button = (QMessageBox::StandardButton)mb.exec();
|
|
|
- if (button == QMessageBox::Cancel) {
|
|
|
- blog(LOG_INFO, "User shut down the program "
|
|
|
- "because OBS was already "
|
|
|
- "running");
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ cancel_launch = button == QMessageBox::Cancel;
|
|
|
+ }
|
|
|
|
|
|
- blog(LOG_WARNING, "User is now running a secondary "
|
|
|
- "instance of OBS!");
|
|
|
+ if (cancel_launch)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (!created_log) {
|
|
|
+ create_log_file(logFile);
|
|
|
+ created_log = true;
|
|
|
+ }
|
|
|
|
|
|
- } else if (already_running && multi) {
|
|
|
+ if (multi) {
|
|
|
blog(LOG_INFO, "User enabled --multi flag and is now "
|
|
|
"running multiple instances of OBS.");
|
|
|
+ } else {
|
|
|
+ blog(LOG_WARNING, "================================");
|
|
|
+ blog(LOG_WARNING, "Warning: OBS is already running!");
|
|
|
+ blog(LOG_WARNING, "================================");
|
|
|
+ blog(LOG_WARNING, "User is now running multiple "
|
|
|
+ "instances of OBS!");
|
|
|
}
|
|
|
|
|
|
/* --------------------------------------- */
|
|
|
+run:
|
|
|
#endif
|
|
|
+
|
|
|
+ if (!created_log) {
|
|
|
+ create_log_file(logFile);
|
|
|
+ created_log = true;
|
|
|
+ }
|
|
|
+
|
|
|
if (argc > 1) {
|
|
|
stringstream stor;
|
|
|
stor << argv[1];
|