From aacc6507417ee8e718b4d2ea31bc1424a83b8201 Mon Sep 17 00:00:00 2001 From: bog Date: Sun, 29 Oct 2023 23:44:19 +0100 Subject: [PATCH] :sparkles: rootdir function. --- src/Script.cpp | 21 +++++++++++++++++++++ src/Script.hpp | 2 ++ 2 files changed, 23 insertions(+) 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;