From 98f495a4858b98198f66f4c956fb4730bf13a390 Mon Sep 17 00:00:00 2001 From: James Crook Date: Thu, 3 Oct 2019 17:17:41 +0100 Subject: [PATCH] Bug 2052 - Mac: Lock file prevents launching Audacity This ameliorates the problem, by prompting the user telling them the lock file location. It does not fully solve it, but should allow us to reduce the bug to P2. --- src/AudacityApp.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 122033596..efd1d47c9 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1897,9 +1897,26 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir) _("Use the New or Open commands in the currently running Audacity\nprocess to open multiple projects simultaneously.\n"); AudacityMessageBox(prompt, _("Audacity is already running"), wxOK | wxICON_ERROR); + +#ifdef __WXMAC__ + // Bug 2052 + // On mac, the lock file may persist and stop Audacity starting properly. + wxString lockFileName = dir + "/" + name; + int action = AudacityMessageBox(wxString::Format( _("If you're sure another copy of Audacity isn't running, Audacity\ncan skip the test for 'Audacity already running' next time\nby removing the lock file:\n\n%s\n\nDo you want to do that?"), + lockFileName + ), + _("Possible Lock File Problem"), + wxYES_NO | wxICON_EXCLAMATION, + NULL); + if (action == wxYES){ + ::wxRemoveFile( lockFileName ); + } +#endif return false; } + + #if defined(__WXMSW__) // Create the DDE IPC server mIPCServ = std::make_unique(IPC_APPL);