mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-18 04:45:39 +00:00
Added explicit sorting of the custom event scripts.
This commit is contained in:
parent
c537de51ef
commit
d362f62b45
|
@ -18,6 +18,9 @@
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "utils/FileSystemUtil.h"
|
#include "utils/FileSystemUtil.h"
|
||||||
#include "utils/PlatformUtil.h"
|
#include "utils/PlatformUtil.h"
|
||||||
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace Scripting
|
namespace Scripting
|
||||||
{
|
{
|
||||||
|
@ -42,7 +45,16 @@ namespace Scripting
|
||||||
scriptDirList.push_back(scriptDir);
|
scriptDirList.push_back(scriptDir);
|
||||||
|
|
||||||
for (auto dirIt = scriptDirList.cbegin(); dirIt != scriptDirList.cend(); ++dirIt) {
|
for (auto dirIt = scriptDirList.cbegin(); dirIt != scriptDirList.cend(); ++dirIt) {
|
||||||
std::list<std::string> scripts = Utils::FileSystem::getDirContent(*dirIt);
|
std::list<std::string> scripts {Utils::FileSystem::getDirContent(*dirIt)};
|
||||||
|
// Sort the scripts in case-sensitive order on Unix/Linux and in case-insensitive order
|
||||||
|
// on macOS and Windows.
|
||||||
|
#if defined(__unix__)
|
||||||
|
scripts.sort([](std::string a, std::string b) { return a.compare(b) < 0; });
|
||||||
|
#else
|
||||||
|
scripts.sort([](std::string a, std::string b) {
|
||||||
|
return Utils::String::toUpper(a).compare(Utils::String::toUpper(b)) < 0;
|
||||||
|
});
|
||||||
|
#endif
|
||||||
for (auto it = scripts.cbegin(); it != scripts.cend(); ++it) {
|
for (auto it = scripts.cbegin(); it != scripts.cend(); ++it) {
|
||||||
std::string arg1Quotation;
|
std::string arg1Quotation;
|
||||||
std::string arg2Quotation;
|
std::string arg2Quotation;
|
||||||
|
|
|
@ -24,6 +24,6 @@ namespace Scripting
|
||||||
const std::string& arg2 = "",
|
const std::string& arg2 = "",
|
||||||
const std::string& arg3 = "",
|
const std::string& arg3 = "",
|
||||||
const std::string& arg4 = "");
|
const std::string& arg4 = "");
|
||||||
} // namespace Scripting
|
}
|
||||||
|
|
||||||
#endif // ES_CORE_SCRIPTING_H
|
#endif // ES_CORE_SCRIPTING_H
|
||||||
|
|
Loading…
Reference in a new issue