mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Simplify std::find
with Common::Contains
In NandPaths.cpp, the `std::initializer_list<char>` of illegal characters has been turned into a `char[]` (similar to the one in GameList.cpp). The reverse iteration in ResourcePack.cpp seemed to provide no benefits, and doing without it it seemed to have no ill effects.
This commit is contained in:
@ -43,6 +43,7 @@
|
||||
#include <QUrl>
|
||||
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/Contains.h"
|
||||
#include "Common/FileUtil.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
@ -805,8 +806,7 @@ bool GameList::AddShortcutToDesktop()
|
||||
// Sanitize the string by removing all characters that cannot be used in NTFS file names
|
||||
std::erase_if(game_name, [](char ch) {
|
||||
static constexpr char illegal_characters[] = {'<', '>', ':', '\"', '/', '\\', '|', '?', '*'};
|
||||
return std::find(std::begin(illegal_characters), std::end(illegal_characters), ch) !=
|
||||
std::end(illegal_characters);
|
||||
return Common::Contains(illegal_characters, ch);
|
||||
});
|
||||
|
||||
std::wstring desktop_path = std::wstring(desktop.get()) + UTF8ToTStr("\\" + game_name + ".lnk");
|
||||
|
Reference in New Issue
Block a user