summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-06 21:59:19 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-06 21:59:19 +0200
commit074ba8c9adcabb90413a9e0d5948929fb389d886 (patch)
treedfcd166283e045c90a32fd6524b378c835b4f807 /plugins
parentaa296438c65a0c0bd2fccea279d3df60821eb388 (diff)
ao plugin: minipsf2 library loading fix
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ao/eng_psf/eng_psf2.c16
1 files changed, 15 insertions, 1 deletions
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;