From ba14cadba1695ed80cfae4c03d6f7724900e4f42 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Mon, 24 Feb 2020 19:46:50 +0000 Subject: [PATCH] Fix 0e8e46f0 for gcc. gcc (mingw) does not allow converting a const char*[] to a char** without -fpermissive. Make some adjustments to the string handling to execute the cmd.exe command to delete the temp file. Signed-off-by: Rafael Kitover --- src/wx/winsparkle-wrapper.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/wx/winsparkle-wrapper.cpp b/src/wx/winsparkle-wrapper.cpp index fb10cb24..f3a0fd23 100644 --- a/src/wx/winsparkle-wrapper.cpp +++ b/src/wx/winsparkle-wrapper.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -50,12 +51,16 @@ WinSparkleDllWrapper::~WinSparkleDllWrapper() delete winsparkle_dll; // Wait for the program to exit and release the DLL before deleting the temp file, otherwise access is denied. - const auto shell_cmd = std::string("ping -n 3 127.0.0.1 > nul&set _file=") + temp_file_name + "&call del %^_file%"; + char executable[] = "cmd.exe"; + char cmd_switch[] = "/c"; - const char* cmd[]{ - "cmd.exe", - "/c", - shell_cmd.c_str(), + char shell_cmd[500]; + snprintf(shell_cmd, 500, "ping -n 3 127.0.0.1 > nul&set _file=%s&call del %%^_file%%", temp_file_name.mb_str().data()); + + char* cmd[]{ + executable, + cmd_switch, + shell_cmd, NULL };