From b98796d28d8b63c5ef8742a749cd6016a06cf9be Mon Sep 17 00:00:00 2001 From: alice <58637860+alicealys@users.noreply.github.com> Date: Mon, 27 Jul 2026 22:42:36 +0200 Subject: [PATCH] fs_homepath working dir --- src/component/io.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/component/io.cpp b/src/component/io.cpp index 4ca4ae8..6e357a5 100644 --- a/src/component/io.cpp +++ b/src/component/io.cpp @@ -13,12 +13,20 @@ namespace io class component final : public component_interface { public: + void on_after_dvar_init([[maybe_unused]] plugin::plugin* plugin) override + { + const auto fs_homepath = game::Dvar_FindVar("fs_homepath"); + if (fs_homepath == nullptr) + { + return; + } + + std::filesystem::current_path(fs_homepath->current.string); + printf("working directory: %s", fs_homepath->current.string); + } + void on_startup([[maybe_unused]] plugin::plugin* plugin) override { - // TODO: fix this, or is it because pluto does it already? - //const auto fs_basegame = game::Dvar_FindVar("fs_basegame"); - //std::filesystem::current_path(fs_basegame->current.string); - gsc::function::add_multiple([](const std::string& file, const std::string& data, const scripting::variadic_args& va) {