From a914ea523eada3f46101dabf59796341b304413d Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Fri, 19 Nov 1999 01:26:36 +0000 Subject: [PATCH] ICU-87 get the library path on os/2 X-SVN-Rev: 187 --- icu4c/source/common/putil.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/icu4c/source/common/putil.c b/icu4c/source/common/putil.c index d4e0ccca123..b81dcb85eba 100644 --- a/icu4c/source/common/putil.c +++ b/icu4c/source/common/putil.c @@ -46,6 +46,7 @@ #elif defined(OS2) # define INCL_DOSMISC # define INCL_DOSERRORS +# define INCL_DOSMODULEMGR # include #elif defined(OS400) # include @@ -758,6 +759,19 @@ getLibraryPath(char *path, int size) { } } # elif defined(OS2) + HMODULE mod=NULLHANDLE; + APIRET rc=DosQueryModuleHandle("icuuc.dll", &mod); + if(rc==NO_ERROR) { + rc=DosQueryModuleName(mod, (LONG)size, path); + if(rc==NO_ERROR) { + /* remove the basename and the last file separator */ + char *lastSep=icu_strrchr(path, U_FILE_SEP_CHAR); + if(lastSep!=NULL) { + *lastSep=0; + return lastSep-path; + } + } + } # elif defined(OS390) # elif defined(OS400) # elif defined(XP_MAC)