Disallow specifying file paths with backslashes

Backslashes only work on Windows. A UMC author may accidentally use them in
their add-on that won't then work properly on GNU/Linux and macOS.
Just disallow them on all platforms to avoid problems.
This commit is contained in:
Jyrki Vesterinen 2017-10-08 10:04:30 +03:00
parent 3bde218c78
commit 1b9c07eb40
3 changed files with 9 additions and 7 deletions

View file

@ -16,30 +16,24 @@ CHANGES
[rasection="Campaigns"] [rasection="Campaigns"]
[list] [list]
[*]The order of the beginner campaigns is now [i]A Tale of Two Brothers, An Orcish Incursion, The South Guard, & Heir to the Throne.[/i] It is hoped that this sequence will be friendlier to new players, encouraging them to start with the simpler AToTB, so they might be better prepared to enjoy HttT.
[/list] [/list]
[/rasection] [/rasection]
[rasection="User Interface"] [rasection="User Interface"]
[list] [list]
[*]Most text boxes now support advanced Input Method Editors (in-game chat does not, however).
[/list] [/list]
[/rasection] [/rasection]
[rawarn="Deprecations and breaking changes"] [rawarn="Deprecations and breaking changes"]
[list] [list]
[*] moveto and enter_hex, exit_hex event no longer abort the movement, [cancel_action] must be used to cancel the current move. [*] File paths with backslashes are no longer accepted. Use forward slashes instead.
[*] The allow_new_game= attribute in [scenario] now defaults to false (it still defaults to tru in [multiplayer])
[*] In gui2 dialogs/widgets [resolution] window_width/height now specifies the minimum window size for that resolution ot be chosen
[/list] [/list]
[/rawarn] [/rawarn]
[rasection="New lua/wml features"] [rasection="New lua/wml features"]
[list] [list]
[*] formula code is now supported in abilities and weapon specials
[*] [multiplayer]/[scenario] now support mp_village_gold, mp_village_support, mp_fog and mp_shroud keys, which are useed as default values for the corresponding keys in [side], it is reccomended to use them instead of the keys in [side] for configurable multiplayer scenarios.
[/list] [/list]
[/rasection] [/rasection]

View file

@ -1,5 +1,8 @@
Version 1.13.11: Version 1.13.11:
* WML Engine: * WML Engine:
* File paths with backslashes are no longer allowed. This ensures that a UMC
author can't accidentally use them and make an add-on that breaks on
GNU/Linux and macOS.
* File paths are now case sensitive even on Windows. * File paths are now case sensitive even on Windows.
Version 1.13.10: Version 1.13.10:

View file

@ -1149,6 +1149,11 @@ static bool is_legal_file(const std::string &filename)
return false; return false;
} }
if (filename.find('\\') != std::string::npos) {
ERR_FS << "Illegal path '" << filename << R"end(' ("\" not allowed, for compatibility with GNU/Linux and macOS).)end" << std::endl;
return false;
}
if (looks_like_pbl(filename)) { if (looks_like_pbl(filename)) {
ERR_FS << "Illegal path '" << filename << "' (.pbl files are not allowed)." << std::endl; ERR_FS << "Illegal path '" << filename << "' (.pbl files are not allowed)." << std::endl;
return false; return false;