mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add minetest.get_game_info
and allow reading game.conf
(#12989)
Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
3fd5bff128
commit
d0a118f5b1
7 changed files with 52 additions and 0 deletions
|
@ -579,6 +579,17 @@ bool ScriptApiSecurity::checkPath(lua_State *L, const char *path,
|
|||
}
|
||||
lua_pop(L, 1); // Pop mod name
|
||||
|
||||
// Allow read-only access to game directory
|
||||
if (!write_required) {
|
||||
const SubgameSpec *game_spec = gamedef->getGameSpec();
|
||||
if (game_spec && !game_spec->path.empty()) {
|
||||
str = fs::AbsolutePath(game_spec->path);
|
||||
if (!str.empty() && fs::PathStartsWith(abs_path, str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Allow read-only access to all mod directories
|
||||
if (!write_required) {
|
||||
const std::vector<ModSpec> &mods = gamedef->getMods();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue