From 24bb6b6b4a40a7e7d9f430f9489626c93c58215d Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 30 Aug 2026 15:53:05 +0200 Subject: readd hack to kitten to load files from exe path, update vbmouse help message & nls files --- kitten.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'kitten.c') diff --git a/kitten.c b/kitten.c index 3a6901e..3e7f9d9 100644 --- a/kitten.c +++ b/kitten.c @@ -163,6 +163,21 @@ const char *kittengets(int setnum, int msgnum, const char *message) } +/** + * Obtains path to current exec. + */ +static char * get_cmd_path(char *buf) +{ + char cmd_drive[_MAX_DRIVE]; + char cmd_dir[_MAX_DIR]; + + _splitpath(__argv[0], cmd_drive, cmd_dir, NULL, NULL); + _makepath(buf, cmd_drive, cmd_dir, "", NULL); + + return buf; +} + + /** * Initialize kitten for program (name). */ @@ -220,8 +235,26 @@ nl_catd kittenopen(char *name) /* we copy the full LANG value or the part before "-" if "-" found */ catlang[2] = '\0'; - /* step through NLSPATH */ - + /* first try to find catalog file in the same path as exe */ + get_cmd_path(catfile); + strcat(catfile, name); + strcat(catfile, "."); + strcat(catfile, catlang); + _kitten_catalog = catread (catfile); + if (_kitten_catalog) + return (_kitten_catalog); + + /* maybe exe_path\nls\cat.%LANG% ? */ + get_cmd_path(catfile); + strcat(catfile, "NLS\\"); + strcat(catfile, name); + strcat(catfile, "."); + strcat(catfile, catlang); + _kitten_catalog = catread (catfile); + if (_kitten_catalog) + return (_kitten_catalog); + + /* otherwise step through NLSPATH */ nlsptr = getenv ("NLSPATH"); if (nlsptr == NULL) { -- cgit v1.2.3