Skip to content

Commit

Permalink
Fixed [scenario] map_file basically being unusable
Browse files Browse the repository at this point in the history
Automatically checking the path relative to a maps/ directory without binary
path support results in an invalid path almost every single time. If I remember
correctly from my testing, the only time that worked was if I added a data/maps
folder.
  • Loading branch information
Vultraz committed Jun 9, 2018
1 parent 5871557 commit 4234965
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -249,6 +249,7 @@
* Fixed Lua errors when setting a music track that cannot be found when the
playlist is already empty, e.g. if there's no music installed for the
game (issue #3194).
* Fixed [scenario] map_file= being unusable in most circumstances.

## Version 1.13.12
### Security fixes
Expand Down
6 changes: 4 additions & 2 deletions src/filesystem_common.cpp
Expand Up @@ -138,12 +138,14 @@ bool ends_with(const std::string& str, const std::string& suffix)
std::string read_map(const std::string& name)
{
std::string res;
std::string map_location = get_wml_location("maps/" + name);
std::string map_location = get_wml_location(name);
if(!map_location.empty()) {
res = read_file(map_location);
}

if (res.empty()) {
// TODO: might be nice to have automatic detection of the maps/ directory?

if(res.empty()) {
res = read_file(get_user_data_dir() + "/editor/maps/" + name);
}

Expand Down

0 comments on commit 4234965

Please sign in to comment.