The full DSO name no longer needs to be specified to load an external mode

This commit is contained in:
Scoopta 2020-03-13 12:30:00 -07:00
parent b2e879cc88
commit b182442f7a

View File

@ -1245,13 +1245,26 @@ static struct mode* add_mode(char* _mode) {
mode_ptr = calloc(1, sizeof(struct mode)); mode_ptr = calloc(1, sizeof(struct mode));
props = map_init(); props = map_init();
init = load_mode("external", mode_ptr, props); char* name = utils_concat(3, "lib", _mode, ".so");
init = load_mode(name, mode_ptr, props);
map_put(props, "exec", _mode); free(name);
if(init == NULL) { if(init == NULL) {
fprintf(stderr, "I would love to show %s but Idk what it is\n", _mode); free(mode_ptr->name);
exit(1); free(mode_ptr);
map_free(props);
mode_ptr = calloc(1, sizeof(struct mode));
props = map_init();
init = load_mode("external", mode_ptr, props);
map_put(props, "exec", _mode);
if(init == NULL) {
fprintf(stderr, "I would love to show %s but Idk what it is\n", _mode);
exit(1);
}
} }
} }
map_put_void(modes, _mode, mode_ptr); map_put_void(modes, _mode, mode_ptr);