diff options
author | Hugues Ross <hugues.ross@gmail.com> | 2020-07-28 13:16:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-28 19:16:57 +0200 |
commit | 3ce03d1c2a63d261c83f5962cd13212697f19472 (patch) | |
tree | f7c7db205866254865d18c711682c984c062b9cc /src/content/subgames.h | |
parent | f948e2c58570df6bc77226b6066fec5ed90051ee (diff) | |
download | minetest-3ce03d1c2a63d261c83f5962cd13212697f19472.tar.gz minetest-3ce03d1c2a63d261c83f5962cd13212697f19472.tar.bz2 minetest-3ce03d1c2a63d261c83f5962cd13212697f19472.zip |
Sanitize world directory names on create. Keep original name separate (#9432)
Blacklisted characters are replaced by '_' in the path. The display name is stored in world.mt, and duplicate file names are resolved by adding an incrementing suffix (_1, _2, _3, etc).
Diffstat (limited to 'src/content/subgames.h')
-rw-r--r-- | src/content/subgames.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/content/subgames.h b/src/content/subgames.h index 4198ea860..35b619aaf 100644 --- a/src/content/subgames.h +++ b/src/content/subgames.h @@ -63,6 +63,8 @@ std::set<std::string> getAvailableGameIds(); std::vector<SubgameSpec> getAvailableGames(); bool getWorldExists(const std::string &world_path); +//! Try to get the displayed name of a world +std::string getWorldName(const std::string &world_path, const std::string &default_name); std::string getWorldGameId(const std::string &world_path, bool can_be_legacy = false); struct WorldSpec @@ -88,4 +90,5 @@ std::vector<WorldSpec> getAvailableWorlds(); // loads the subgame's config and creates world directory // and world.mt if they don't exist -bool loadGameConfAndInitWorld(const std::string &path, const SubgameSpec &gamespec); +void loadGameConfAndInitWorld(const std::string &path, const std::string &name, + const SubgameSpec &gamespec, bool create_world); |