feat: enhance loadBridge function to handle directory paths for bridge library

This commit is contained in:
MayaTheShy
2025-11-08 22:50:54 -05:00
parent 8e48c331db
commit a151e8a745

View File

@@ -284,7 +284,14 @@ bool StardustBridge::loadBridge() {
const char* overridePath = std::getenv("STARWORLD_BRIDGE_PATH");
std::vector<std::string> candidates;
if (overridePath) {
candidates.emplace_back(std::string(overridePath));
std::string pathStr(overridePath);
// If it's a directory, append the library filename
struct stat st;
if (stat(pathStr.c_str(), &st) == 0 && S_ISDIR(st.st_mode)) {
candidates.emplace_back(pathStr + "/libstardust_bridge.so");
} else {
candidates.emplace_back(pathStr);
}
}
// Likely local dev output
candidates.emplace_back("./bridge/target/debug/libstardust_bridge.so");