diff --git a/src/Script.cpp b/src/Script.cpp index 7c0dfd3..da36b56 100644 --- a/src/Script.cpp +++ b/src/Script.cpp @@ -36,6 +36,10 @@ namespace d2 scm_c_define_gsubr("mouse-y", 0, 0, 0, reinterpret_cast(&fn_mouse_y)); + // Filesystem + // ---------- + scm_c_define_gsubr("rootdir", 0, 0, 1, + reinterpret_cast(&fn_rootdir)); } @@ -181,4 +185,21 @@ namespace d2 { return scm_from_int32(Script::game->mouse_y()); } + + /*static*/ SCM Script::fn_rootdir(SCM scm_args) + { + std::filesystem::path path = + std::filesystem::current_path(); + + size_t sz = scm_to_int32(scm_length(scm_args)); + + for (size_t i=0; i game; static glm::vec4 color;