From 533e13437e94c168a6db96972d2cdd3e48b1c07f Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 18 Mar 2023 11:02:04 +0800 Subject: [PATCH] Update io.h --- src/io.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/io.h b/src/io.h index fff75fe0..e342d900 100644 --- a/src/io.h +++ b/src/io.h @@ -122,6 +122,12 @@ void add_module_os(VM* vm){ } return VAR(path.string()); }); + + vm->bind_func<1>(mod, "path_exists", [](VM* vm, const Args& args){ + std::filesystem::path path(CAST(Str&, args[0]).c_str()); + bool exists = std::filesystem::exists(path); + return VAR(exists); + }); } } // namespace pkpy