#pragma once // python_stdlib — where the embedded interpreter's standard library is on this platform // (docs/PORT-PLAN.md 批次 2P step 3c). // // CPython opens python27.zip with its own stdio, so it needs a real filesystem path. That is free on // the desktop, where res:// is a directory on disk, but on Android and iOS res:// is inside the PCK, // which nothing outside Godot can read. There the zip is copied once into the sandbox (user://) and // the copy is accepted only when it hashes to the digest built beside the zip, so an interrupted // first start or a zip replaced by a new build re-stages instead of feeding zipimport a torn file. // // Only this file knows about res:// / user://: PythonHost (platform/ScriptLib) stays godot-free and // is told the path, through PythonHost::SetDefaultStdLibPath. #include #include namespace mtgodot { // The real filesystem path of python27.zip, staging it out of res:// when res:// is not on disk. // Empty when the zip is missing or the staged copy does not verify; the reason goes to *error. // force_stage runs the mobile path even where res:// is readable, which is how it is tested. godot::String stage_python_stdlib(godot::String *error = nullptr, bool force_stage = false); class Metin2Python : public godot::Object { GDCLASS(Metin2Python, godot::Object) public: // Returns the path and, when the embedded interpreter is built in, hands it to PythonHost so // PythonHost::DefaultStdLibPath() answers with it from then on. static godot::String stdlib_path(bool force_stage); static godot::String last_error(); protected: static void _bind_methods(); }; } // namespace mtgodot