summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWon-Kyu Park <wkpark@gmail.com>2023-02-27 02:39:18 +0900
committerWon-Kyu Park <wkpark@gmail.com>2023-03-02 12:41:11 +0900
commit30c0382d2067c3bfb1895ed0d8f52859d5df62cb (patch)
tree06913b8a79af262d396465ff1d5e2c6040a5910c
parent796cf6a7b4d2b9fc465ddabc50b75b9abe526415 (diff)
downloadlibhangul-30c0382d2067c3bfb1895ed0d8f52859d5df62cb.tar.gz
win32: fix for win32.
-rw-r--r--hangul/hangulkeyboard.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hangul/hangulkeyboard.c b/hangul/hangulkeyboard.c
index bf87923..97be149 100644
--- a/hangul/hangulkeyboard.c
+++ b/hangul/hangulkeyboard.c
@@ -29,7 +29,6 @@
#ifdef HAVE_GLOB_H
#include <glob.h>
#endif /* HAVE_GLOB_H */
-#include <libgen.h>
#include <expat.h>
#endif /* ENABLE_EXTERNAL_KEYBOARDS */
@@ -679,8 +678,11 @@ on_element_start(void* data, const XML_Char* element, const XML_Char** attr)
strncpy(path, file, n);
} else {
char* orig_path = strdup(context->path_stack[top]);
- char* dir = dirname(orig_path);
- snprintf(path, n, "%s/%s", dir, file);
+ char* last_slash = strrchr(orig_path, '/');
+ if (last_slash)
+ last_slash[0] = '\0';
+
+ snprintf(path, n, "%s/%s", orig_path, file);
free(orig_path);
}