mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-04-28 12:27:59 +03:00
Removed require from scripts folder
This commit is contained in:
parent
e70b578e0d
commit
dc76025a7f
1 changed files with 4 additions and 14 deletions
|
@ -83,20 +83,10 @@ int ScriptingLayer::Require(lua_State* L) {
|
|||
std::optional<std::string> result = LoadFromO2R(path);
|
||||
|
||||
if(!result.has_value()){
|
||||
// TODO: This could be unsafe, validate it
|
||||
const auto error = "Failed to load " + path + ", from both O2R and disk";
|
||||
std::ifstream input("scripts/" + path);
|
||||
|
||||
if (!input.is_open()) {
|
||||
SPDLOG_ERROR(error);
|
||||
sol::stack::push(L, error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> data = std::vector<uint8_t>(std::istreambuf_iterator(input), {});
|
||||
input.close();
|
||||
|
||||
result = std::string(data.begin(), data.end());
|
||||
const auto error = "Failed to include " + path;
|
||||
SPDLOG_ERROR(error);
|
||||
sol::stack::push(L, error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const auto& script = result.value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue