From 2a9d13bfc83132b44f4098ec9e314b7a05646666 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Mon, 6 Oct 2025 01:56:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20xy=5Fnormalize=5Fpath=20?= =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B3=84=E9=9C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index bbbd450..8b0592f 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1249,13 +1249,14 @@ xy_normalize_path (const char *path) if (xy_str_start_with (new, "~")) { - new = xy_2strcat (xy_os_home, xy_str_delete_prefix (new, "~")); + xy_str_swap (&new, xy_2strcat (xy_os_home, xy_str_delete_prefix (new, "~"))); } if (xy.on_windows) - return xy_str_gsub (new, "/", "\\"); - else - return new; + { + xy_str_swap (&new, xy_str_gsub (new, "/", "\\")); + } + return new; }