From 747a1dca97c1b351af1c3cac5e2ed669b98bbd6e Mon Sep 17 00:00:00 2001 From: deepend Date: Sun, 15 Feb 2026 22:13:13 -0700 Subject: [PATCH] =?UTF-8?q?I=20made=20a=20targeted=20fix=20for=20the=20Plu?= =?UTF-8?q?gins/Scripts=20Load=20button=20on=20Windows:=20before=20issuing?= =?UTF-8?q?=20LOAD=20...,=20the=20selected=20file=20path=20is=20now=20copi?= =?UTF-8?q?ed=20and=20normalized=20to=20forward=20slashes=20(\=20=E2=86=92?= =?UTF-8?q?=20/)=20under=20#ifdef=20WIN32,=20then=20quoted=20if=20needed.?= =?UTF-8?q?=20This=20keeps=20Linux=20behavior=20unchanged=20and=20avoids?= =?UTF-8?q?=20Windows=20path=20parsing=20issues=20in=20the=20command=20pat?= =?UTF-8?q?h.=20The=20load=20dialog=20wiring=20remains=20the=20same=20(sam?= =?UTF-8?q?e=20callback=20and=20filters),=20only=20the=20command=20path=20?= =?UTF-8?q?construction=20was=20hardened.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fe-gtk/plugingui.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c index 04031f86..199e5ff7 100644 --- a/src/fe-gtk/plugingui.c +++ b/src/fe-gtk/plugingui.c @@ -202,6 +202,7 @@ plugingui_load_cb (session *sess, char *file) if (file) { char *buf; + char *load_target; target_sess = is_session (sess) ? sess : current_sess; if (!is_session (target_sess)) @@ -210,11 +211,22 @@ plugingui_load_cb (session *sess, char *file) return; } - if (strchr (file, ' ')) - buf = g_strdup_printf ("LOAD \"%s\"", file); + load_target = g_strdup (file); + +#ifdef WIN32 + /* + * The command parser is more reliable with forward slashes on Windows + * paths (especially when quoted), so normalize before issuing LOAD. + */ + g_strdelimit (load_target, "\\", '/'); +#endif + + if (strchr (load_target, ' ')) + buf = g_strdup_printf ("LOAD \"%s\"", load_target); else - buf = g_strdup_printf ("LOAD %s", file); + buf = g_strdup_printf ("LOAD %s", load_target); handle_command (target_sess, buf, FALSE); + g_free (load_target); g_free (buf); } }