Build self-contained macOS client and verify native beta path

This commit is contained in:
shen
2026-09-24 00:59:08 -07:00
parent 400973da11
commit a57c83dd71
12 changed files with 331 additions and 12 deletions
@@ -49,6 +49,7 @@
#include <condition_variable>
#include <cstdlib>
#include <filesystem>
#include <memory>
#include <mutex>
#include <pthread.h>
@@ -346,8 +347,18 @@ bool Start(const char* stdlib_path, std::string* error)
return true;
// 40250 Main (UserInterface.cpp:410): if (LocaleService_LoadGlobal(hInstance)) SetDefaultCodePage(...).
LocaleService_LoadConfig("locale.cfg");
std::string locale_config = "locale.cfg";
if (const char* client = std::getenv("MT_40250_CLIENT"))
locale_config = (std::filesystem::path(client) / "locale.cfg").string();
LocaleService_LoadConfig(locale_config.c_str());
SetDefaultCodePage(LocaleService_GetCodePage());
if (const char* data_dir = std::getenv("MT_40250_USER_DATA_DIR"))
{
std::error_code ec;
std::filesystem::current_path(data_dir, ec);
if (ec)
return fail(error, "cannot use player settings directory: " + ec.message());
}
const std::string stdlib = (stdlib_path && *stdlib_path) ? stdlib_path : PythonHost::DefaultStdLibPath();
if (stdlib.empty())
@@ -252,7 +252,12 @@ void CPythonBackground::__CreateProperty()
}
else
{
m_PropertyManager.Initialize("pack/property");
// The exported client runs with player settings as CWD; its read-only property pack
// lives beside the other bundled 40250 packs. Use the same root registered by PackBackend.
std::string property_pack = "pack/property";
if (const char* client = getenv("MT_40250_CLIENT"))
property_pack = std::string(client) + "/pack/Property";
m_PropertyManager.Initialize(property_pack.c_str());
}
}
+8 -2
View File
@@ -7,6 +7,7 @@
#include <godot_cpp/variant/utility_functions.hpp>
#include <string>
#include <cstdio>
#ifdef MTGODOT_HAVE_PYTHON
#include "platform/ScriptLib/PythonHost.h"
@@ -60,8 +61,13 @@ String stage_python_stdlib(String *error, bool force_stage) {
// nothing is copied. In an exported game globalize_path() returns a path next to the executable
// that does not exist, which is exactly the case the staging below is for.
const String in_place = settings->globalize_path(ZIP_RES);
if (!force_stage && !in_place.begins_with("res://") && FileAccess::file_exists(in_place)) {
return in_place;
if (!force_stage && !in_place.begins_with("res://")) {
// FileAccess may resolve an exported PCK entry through a relative globalized path. CPython
// uses fopen(), so only return the path when libc can open a real on-disk zip there.
if (FILE *file = std::fopen(in_place.utf8().get_data(), "rb")) {
std::fclose(file);
return in_place;
}
}
const String want = expected_sha();