From: Javier Sancho Date: Wed, 10 Jun 2020 06:46:48 +0000 (+0200) Subject: Allow mods structured like modules X-Git-Url: https://git.jsancho.org/?p=dungeon-master.git;a=commitdiff_plain;h=feed3accdc0482b11535c72119ea73f627f633ed Allow mods structured like modules --- diff --git a/src/mods.cpp b/src/mods.cpp index abdf472..dea09b6 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -43,6 +43,13 @@ void scm_init_dungeon_master_module () scm_c_define_module ("dungeon-master", init_dungeon_master_module, NULL); } +void add_to_load_path (std::string path) +{ + // Add path to %load-path variable, needed for modules created in mods + std::string exp = "(add-to-load-path \"" + path + "\")"; + scm_c_eval_string (exp.c_str ()); +} + void load_dmaster_mods () { scm_init_guile (); @@ -58,6 +65,7 @@ void load_dmaster_mods () for (const std::string &path : paths) { mods_path = path + PATH_DELIM + "mods"; + add_to_load_path (mods_path); mods_dir = opendir (mods_path.c_str ()); if (mods_dir != NULL) {