mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-10-25 13:55:38 +00:00
I made a targeted fix for the Plugins/Scripts Load button on Windows: before issuing LOAD ..., the selected file path is now copied and normalized to forward slashes (\ → /) under #ifdef WIN32, then quoted if needed. This keeps Linux behavior unchanged and avoids Windows path parsing issues in the command path.
The load dialog wiring remains the same (same callback and filters), only the command path construction was hardened.
This commit is contained in:
1 parent
16f2c6cc0d
commit
747a1dca97
1 file changed
+15
-3
+15
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user