@@ -1085,20 +1085,25 @@ class Core final : public ICore, public PlayerConnectEventHandler, public Consol
1085
1085
auto excludeCfg = config.getStrings (" exclude" );
1086
1086
if (!componentsCfg || componentsCfg->empty ())
1087
1087
{
1088
- for (auto & de : ghc::filesystem::directory_iterator (path))
1088
+ for (auto & de : ghc::filesystem::recursive_directory_iterator (path))
1089
1089
{
1090
1090
ghc::filesystem::path p = de.path ();
1091
1091
if (p.extension () == LIBRARY_EXT)
1092
1092
{
1093
1093
if (excludeCfg && !excludeCfg->empty ())
1094
1094
{
1095
- p.replace_extension (" " );
1095
+ ghc::filesystem::path rel = ghc::filesystem::relative (p, path);
1096
+ rel.replace_extension ();
1096
1097
// Is this in the "don't load" list?
1097
- if (std::find (excludeCfg->begin (), excludeCfg->end (), p.filename ().string ()) != excludeCfg->end ())
1098
+ const auto isExcluded = [rel = std::move (rel)](const String& exclude)
1099
+ {
1100
+ return ghc::filesystem::path (exclude) == rel;
1101
+ };
1102
+ if (std::find_if (excludeCfg->begin (), excludeCfg->end (), isExcluded)
1103
+ != excludeCfg->end ())
1098
1104
{
1099
1105
continue ;
1100
1106
}
1101
- p.replace_extension (LIBRARY_EXT);
1102
1107
}
1103
1108
1104
1109
IComponent* component = loadComponent (p);
@@ -1121,8 +1126,15 @@ class Core final : public ICore, public PlayerConnectEventHandler, public Consol
1121
1126
1122
1127
if (excludeCfg && !excludeCfg->empty ())
1123
1128
{
1129
+ ghc::filesystem::path rel = ghc::filesystem::relative (file, path);
1130
+ rel.replace_extension ();
1124
1131
// Is this in the "don't load" list?
1125
- if (std::find (excludeCfg->begin (), excludeCfg->end (), file.filename ().string ()) != excludeCfg->end ())
1132
+ const auto isExcluded = [rel = std::move (rel)](const String& exclude)
1133
+ {
1134
+ return ghc::filesystem::path (exclude) == rel;
1135
+ };
1136
+ if (std::find_if (excludeCfg->begin (), excludeCfg->end (), isExcluded)
1137
+ != excludeCfg->end ())
1126
1138
{
1127
1139
continue ;
1128
1140
}
0 commit comments