mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix server favorites not saving when client/serverlist/ doesn't exist already (#11152)
This commit is contained in:
parent
a0e7a4a0df
commit
0abc1e98ed
3 changed files with 18 additions and 13 deletions
|
@ -716,21 +716,24 @@ int ModApiMainMenu::l_get_mainmenu_path(lua_State *L)
|
|||
}
|
||||
|
||||
/******************************************************************************/
|
||||
bool ModApiMainMenu::mayModifyPath(const std::string &path)
|
||||
bool ModApiMainMenu::mayModifyPath(std::string path)
|
||||
{
|
||||
path = fs::RemoveRelativePathComponents(path);
|
||||
|
||||
if (fs::PathStartsWith(path, fs::TempPath()))
|
||||
return true;
|
||||
|
||||
if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "games")))
|
||||
return true;
|
||||
std::string path_user = fs::RemoveRelativePathComponents(porting::path_user);
|
||||
|
||||
if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "mods")))
|
||||
if (fs::PathStartsWith(path, path_user + DIR_DELIM "client"))
|
||||
return true;
|
||||
|
||||
if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "textures")))
|
||||
if (fs::PathStartsWith(path, path_user + DIR_DELIM "games"))
|
||||
return true;
|
||||
|
||||
if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "worlds")))
|
||||
if (fs::PathStartsWith(path, path_user + DIR_DELIM "mods"))
|
||||
return true;
|
||||
if (fs::PathStartsWith(path, path_user + DIR_DELIM "textures"))
|
||||
return true;
|
||||
if (fs::PathStartsWith(path, path_user + DIR_DELIM "worlds"))
|
||||
return true;
|
||||
|
||||
if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_cache)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue