From 074ba8c9adcabb90413a9e0d5948929fb389d886 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 6 Jul 2010 21:59:19 +0200 Subject: ao plugin: minipsf2 library loading fix --- plugins/ao/eng_psf/eng_psf2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/ao/eng_psf/eng_psf2.c b/plugins/ao/eng_psf/eng_psf2.c index 854e9012..dd44fdda 100644 --- a/plugins/ao/eng_psf/eng_psf2.c +++ b/plugins/ao/eng_psf/eng_psf2.c @@ -491,11 +491,25 @@ void *psf2_start(const char *path, uint8 *buffer, uint32 length) if (s->c->lib[0] != 0) { uint64 tmp_length; + char libpath[PATH_MAX]; + const char *e = path + strlen(path); + while (e > path && *e != '/') { + e--; + } + if (*e == '/') { + e++; + memcpy (libpath, path, e-path); + libpath[e-path] = 0; + strcat (libpath, s->c->lib); + } + else { + strcpy (libpath, s->c->lib); + } #if DEBUG_LOADER printf("Loading library: %s\n", s->c->lib); #endif - if (ao_get_lib(s->c->lib, &s->lib_raw_file, &tmp_length) != AO_SUCCESS) + if (ao_get_lib(libpath, &s->lib_raw_file, &tmp_length) != AO_SUCCESS) { free (s); return NULL; -- cgit v1.2.3