From e96108d3c81e11e4cd91e8e6fb59e36399c2a160 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 1 Oct 2021 17:26:01 +0200 Subject: [PATCH] Fix int ExecuteFile(...) incorrect behavior with quoted filename. It uses a wxExecute() version that add quotes to filename, so the final filename was incorrect. Fixes #9292 https://gitlab.com/kicad/code/kicad/issues/9292 --- common/gestfich.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 7b8ab266c6..c8467ad5f1 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -140,7 +140,14 @@ int ExecuteFile( const wxString& aEditorName, const wxString& aFileName, wxProce args[i++] = param.wc_str(); if( !aFileName.IsEmpty() ) - args[i++] = aFileName.wc_str(); + { + wxString name = aFileName; + + // A quoted filename is incorrectly handled here, perhaps because wxExecute + // add quotes. So remove quotes if any (they also are illegal in filenames). + name.Replace( "\"", "" ); + args[i++] = name.wc_str(); + } args[i] = nullptr;