From ae72e78592b6c8ba807e7d56316c51cd5057d29a Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sat, 14 Dec 2024 19:51:21 +0800 Subject: [PATCH] Fix current dir case --- include/xy.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/xy.h b/include/xy.h index a7d1d64..bc5d753 100644 --- a/include/xy.h +++ b/include/xy.h @@ -780,11 +780,21 @@ xy_parent_dir (const char *path) if (xy_on_windows) { last = strrchr (dir, '\\'); + if (!last) + { + /* current dir */ + return "."; + } *last = '\0'; } else { last = strrchr (dir, '/'); + if (!last) + { + /* current dir */ + return "."; + } *last = '\0'; } return dir;