+
+ std::set<std::string> paths = get_dm_paths();
+ DIR* mods_dir;
+ struct dirent* mod;
+ std::string
+ mods_path,
+ mod_main;
+
+ for (const std::string &path : paths) {
+ mods_path = path + DIR_DELIM + "mods";
+ mods_dir = opendir(mods_path.c_str());
+ if (mods_dir != NULL) {
+ while (mod = readdir(mods_dir)) {
+ if (strcmp(mod->d_name, ".") != 0 && strcmp(mod->d_name, "..") != 0) {
+ mod_main = mods_path + DIR_DELIM + mod->d_name + DIR_DELIM + "main.scm";
+ scm_primitive_load(scm_from_locale_string(mod_main.c_str()));
+ }
+ }
+ }
+ closedir(mods_dir);
+ }