diff --git a/require.c b/require.c index bf1608b..e7bc33b 100644 --- a/require.c +++ b/require.c @@ -599,7 +599,11 @@ void registerModule(const char* module, const char* version, const char* locatio putenvprintf("MODULE=%s", module); putenvprintf("%s_VERSION=%s", module, version); - if (location) putenvprintf("%s_DIR=%s", module, m->content+lm+lv); + if (location) + { + putenvprintf("%s_DIR=%s", module, m->content+lm+lv); + insertDirIntoPath("SCRIPT_PATH", m->content+lm+lv); + } /* only do registration register stuff at init */ if (interruptAccept) return; @@ -681,10 +685,7 @@ static int findLibRelease ( *p=0; symname++; /* get "" from "_LibRelease" */ if ((p = strstr(name, "/" LIBDIR)) != NULL) p[1]=0; /* cut "" before LIBDIR */ if (getLibVersion(symname) == NULL) - { registerModule(symname, version, location); - insertDirIntoPath("SCRIPT_PATH", location); - } } dlclose(handle); return 0; @@ -733,10 +734,7 @@ static void registerExternalModules() *p=0; symname++; /* get "" from "_LibRelease" */ if ((p = strstr(name, "\\" LIBDIR)) != NULL) p[1]=0; /* cut "" before LIBDIR */ if (getLibVersion(symname) == NULL) - { registerModule(symname, version, location); - insertDirIntoPath("SCRIPT_PATH", location); - } } } } @@ -1270,6 +1268,7 @@ static int require_priv(const char* module, const char* version, const char* arg printf("require: library found in %s\n", dirname); snprintf(filename, sizeof(filename), "%s%n", dirname, &releasediroffs); putenvprintf("MODULE=%s", module); + insertDirIntoPath("SCRIPT_PATH", dirname); } else { @@ -1555,7 +1554,6 @@ loadlib: filename[releasediroffs] = 0; registerModule(module, found, filename); } - insertDirIntoPath("SCRIPT_PATH", filename); status = 0;