Un-hardcoded module search path

Until now, the module search path has been hardcoded to the “modules” directory; I have now changed that so that it can be changed by the user. Furthermore, multiple paths can be provided – if SIEGE cannot find the module in the first path, it continues seeking in the second path and so on.

Furthermore, four new functions are added:

/*
 * Try "ndirs" directories in order - if the module cannot be found in the first,
 * continue to second, if it's not there, continue to third, et cetera...
 *
 * Up to 256 directories can be provided.
 */
void sgModuleSetLoadDirsv(size_t ndirs, va_list args);
void sgModuleSetLoadDirs(size_t ndirs, ...);
// same as calling sgModuleSetLoadDirs(1, dir)
void sgModuleSetLoadDir(const char* dir);
// get the current list of dirs
char** sgModuleGetLoadDirs(size_t* ndirs);

I am also going to un-hardcode the prefix (the “[lib]SGModule-” bit) soon.

UPDATE: The prefixes are now un-hardcoded (though the code hasn’t been tested well); the API is similar to the directories, only replace “Dir”/”Dirs” with “Prefix”/”Prefixes”.

Posted in SIEGE.