From 6e0d940b984aa639e434978e816752efcc05d12c Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 5 Oct 2022 20:30:46 +0300 Subject: [PATCH] kiplatform: Add quotes to restart registration command line. --- libs/kiplatform/msw/app.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/kiplatform/msw/app.cpp b/libs/kiplatform/msw/app.cpp index 244ff14cd2..c7b9118f4d 100644 --- a/libs/kiplatform/msw/app.cpp +++ b/libs/kiplatform/msw/app.cpp @@ -121,15 +121,18 @@ bool KIPLATFORM::APP::IsOperatingSystemUnsupported() bool KIPLATFORM::APP::RegisterApplicationRestart( const wxString& aCommandLine ) { + // Command line arguments with spaces require quotes. + wxString restartCmd = wxS( "\"" ) + aCommandLine + wxS( "\"" ); + // Ensure we don't exceed the maximum allowable size - if( aCommandLine.length() > RESTART_MAX_CMD_LINE - 1 ) + if( restartCmd.length() > RESTART_MAX_CMD_LINE - 1 ) { return false; } HRESULT hr = S_OK; - hr = ::RegisterApplicationRestart( aCommandLine.wc_str(), RESTART_NO_PATCH ); + hr = ::RegisterApplicationRestart( restartCmd.wc_str(), RESTART_NO_PATCH ); return SUCCEEDED( hr ); }