Skip to content

Commit

Permalink
forbid multiple instances of program
Browse files Browse the repository at this point in the history
creating file `multi_instance.opt` can be used to block this feature. yet its not intended for normal users.
  • Loading branch information
israpps committed May 24, 2024
1 parent bed061c commit b8f94c7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions HDL-Batch-installer-SRC/HDL_Batch_installerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
**************************************************************/
#include "HDL_Batch_installerApp.h"
#include "flags.h"
#include <wx/snglinst.h>

//(*AppHeaders
#include "HDL_Batch_installerMain.h"
#include <wx/image.h>
Expand All @@ -19,6 +21,17 @@ IMPLEMENT_APP(HDL_Batch_installerApp);
wxString Get_env(wxString ENV);
bool HDL_Batch_installerApp::OnInit()
{

wxSingleInstanceChecker* instance_chk = new wxSingleInstanceChecker;
if (instance_chk->IsAnotherRunning() && (!wxFileExists("Common\\multi_instance.opt")) )
{
wxLogError(_("Another program instance is already running, aborting."));

delete instance_chk; // OnExit() won't be called if we return false
instance_chk = nullptr;

return false;
}
bool first_time = false;
const wxString DOWNLOAD_COMMAND = "Common\\wget -q --show-progress https://github.com/israpps/HDL-Batch-installer/raw/main/svr/_ICN.7z -O Common\\_ICN.7z",
EXTRACTION_COMMAND = "Common\\7z.exe x -oCommon -bso0 -pPDPA -y Common\\_ICN.7z";
Expand Down

0 comments on commit b8f94c7

Please sign in to comment.