IncludePathFilters
IncludePathFilters
#Overview
name: IncludePathFilters
The value of this variable can be defined or overridden in .ini config files. 26
.ini config files referencing this setting variable.
It is referenced in 14
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of IncludePathFilters is to specify which paths should be included when gathering text for localization in Unreal Engine 5. This setting variable is used to define the directories and files that should be processed during the text gathering process.
IncludePathFilters is primarily used in the localization system of Unreal Engine 5. It is referenced in various commandlets and scripts related to text gathering and localization, such as GatherTextFromAssetsCommandlet, GatherTextFromMetaDataCommandlet, and GatherTextFromSourceCommandlet.
The value of this variable is typically set in configuration files or through command-line parameters when running localization-related commandlets. It can also be modified programmatically in certain cases, such as when generating localization configuration files.
IncludePathFilters often interacts with ExcludePathFilters, which specifies paths to be excluded from the text gathering process. Together, these two variables define the scope of files and directories to be processed for localization.
Developers should be aware of the following when using IncludePathFilters:
- It supports wildcard patterns (e.g., “.umap” or “Content/”).
- Paths are typically converted to full paths for consistency.
- If no IncludePathFilters are specified, it may result in an error or no files being processed.
- The order of include and exclude filters matters, as they are processed sequentially.
Best practices for using IncludePathFilters include:
- Be specific with your include paths to avoid unnecessary processing of irrelevant files.
- Use wildcards judiciously to capture all relevant files without including unwanted content.
- Regularly review and update your include paths as your project structure evolves.
- Consider using both IncludePathFilters and ExcludePathFilters for fine-grained control over the localization process.
- Verify the paths are correct and exist in your project structure to avoid errors during the localization process.
#Setting Variables
#References In INI files
<Workspace>/Engine/Config/Localization/Category.ini:31, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Category.ini:32, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Category.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Category.ini:34, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:44, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Editor.ini:45, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Editor.ini:57, section: [GatherTextStep2]
<Workspace>/Engine/Config/Localization/Editor.ini:58, section: [GatherTextStep2]
<Workspace>/Engine/Config/Localization/Editor.ini:59, section: [GatherTextStep2]
<Workspace>/Engine/Config/Localization/Editor.ini:60, section: [GatherTextStep2]
<Workspace>/Engine/Config/Localization/EditorTutorials.ini:35, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:50, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Keywords.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Keywords.ini:27, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Keywords.ini:28, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Keywords.ini:29, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/PropertyNames.ini:31, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/PropertyNames.ini:32, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/PropertyNames.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/PropertyNames.ini:34, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/ToolTips.ini:31, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/ToolTips.ini:32, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/ToolTips.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/ToolTips.ini:34, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:44, section: [GatherTextStep1]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:45, section: [GatherTextStep1]
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:368
Scope (from outer to inner):
file
namespace LocalizationConfigurationScript
function FLocalizationConfigurationScript GenerateGatherTextConfigFile
Source code excerpt:
for (const auto& IncludePath : Target->Settings.GatherFromPackages.IncludePathWildcards)
{
ConfigSection.Add( TEXT("IncludePathFilters"), FString::Printf(TEXT("%s%s"), *FLocalizationGatherPathRootUtil::GetResolvedPathRootToken(IncludePath.PathRoot), *IncludePath.Pattern) );
}
// Exclude Paths
ConfigSection.Add( TEXT("ExcludePathFilters"), TEXT("Content/Localization/*") );
for (const auto& ExcludePath : Target->Settings.GatherFromPackages.ExcludePathWildcards)
{
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:416
Scope (from outer to inner):
file
namespace LocalizationConfigurationScript
function FLocalizationConfigurationScript GenerateGatherTextConfigFile
Source code excerpt:
for (const auto& IncludePath : Target->Settings.GatherFromMetaData.IncludePathWildcards)
{
ConfigSection.Add( TEXT("IncludePathFilters"), FString::Printf(TEXT("%s%s"), *FLocalizationGatherPathRootUtil::GetResolvedPathRootToken(IncludePath.PathRoot), *IncludePath.Pattern) );
}
// Exclude Paths
for (const auto& ExcludePath : Target->Settings.GatherFromMetaData.ExcludePathWildcards)
{
ConfigSection.Add( TEXT("ExcludePathFilters"), FString::Printf(TEXT("%s%s"), *FLocalizationGatherPathRootUtil::GetResolvedPathRootToken(ExcludePath.PathRoot), *ExcludePath.Pattern) );
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/UserGeneratedContentLocalization.cpp:317
Scope (from outer to inner):
file
namespace UserGeneratedContentLocalization
function bool ExportLocalization
Source code excerpt:
ConfigSection.Add(TEXT("PackageFileNameFilters"), TEXT("*.umap"));
ConfigSection.Add(TEXT("IncludePathFilters"), FPaths::ConvertRelativePathToFull(FPaths::Combine(Plugin->GetContentDir(), TEXT("*"))));
ConfigSection.Add(TEXT("ExcludePathFilters"), FPaths::ConvertRelativePathToFull(FPaths::Combine(Plugin->GetContentDir(), TEXT("Localization"), TEXT("*"))));
ConfigSection.Add(TEXT("ExcludePathFilters"), FPaths::ConvertRelativePathToFull(FPaths::Combine(Plugin->GetContentDir(), TEXT("L10N"), TEXT("*"))));
if (const FString* CollectionFilter = ExportOptions.PluginNameToCollectionNameFilter.Find(Plugin->GetName()))
{
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/UserGeneratedContentLocalization.cpp:336
Scope (from outer to inner):
file
namespace UserGeneratedContentLocalization
function bool ExportLocalization
Source code excerpt:
ConfigSection.Add(TEXT("CommandletClass"), TEXT("GatherTextFromVerse"));
ConfigSection.Add(TEXT("IncludePathFilters"), FPaths::ConvertRelativePathToFull(FPaths::Combine(Plugin->GetBaseDir(), TEXT("*"))));
ConfigSection.Add(TEXT("ExcludePathFilters"), FPaths::ConvertRelativePathToFull(FPaths::Combine(Plugin->GetContentDir(), TEXT("Localization"), TEXT("*"))));
ConfigSection.Add(TEXT("ExcludePathFilters"), FPaths::ConvertRelativePathToFull(FPaths::Combine(Plugin->GetContentDir(), TEXT("L10N"), TEXT("*"))));
GatherConfig.AddGatherTextStep(GatherStepIndex++, MoveTemp(ConfigSection));
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Commandlets/GatherTextFromAssetsCommandlet.h:104
Scope (from outer to inner):
file
class class UGatherTextFromAssetsCommandlet : public UGatherTextCommandletBase
Source code excerpt:
TArray<FString> ModulesToPreload;
TArray<FString> IncludePathFilters;
TArray<FString> CollectionFilters;
TArray<FString> ExcludePathFilters;
TArray<FString> PackageFileNameFilters;
TArray<FString> ExcludeClassNames;
TArray<FString> ManifestDependenciesList;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromAssetsCommandlet.cpp:589
Scope (from outer to inner):
file
function void UGatherTextFromAssetsCommandlet::FilterAssetsBasedOnIncludeExcludePaths
Source code excerpt:
void UGatherTextFromAssetsCommandlet::FilterAssetsBasedOnIncludeExcludePaths(TArray<FAssetData>& InOutAssetDataArray) const
{
const FFuzzyPathMatcher FuzzyPathMatcher = FFuzzyPathMatcher(IncludePathFilters, ExcludePathFilters);
const double FilteringAssetsByIncludeExcludePathsStartTime = FPlatformTime::Seconds();
InOutAssetDataArray.RemoveAll([&](const FAssetData& PartiallyFilteredAssetData) -> bool
{
if (PartiallyFilteredAssetData.IsRedirector())
{
// Redirectors never have localization
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromAssetsCommandlet.cpp:854
Scope (from outer to inner):
file
function bool UGatherTextFromAssetsCommandlet::ParseCommandLineHelper
Source code excerpt:
}
FGatherTextDelegates::GetAdditionalGatherPaths.Broadcast(GatherManifestHelper->GetTargetName(), IncludePathFilters, ExcludePathFilters);
// Get destination path
if (!GetPathFromConfig(*SectionName, TEXT("DestinationPath"), DestinationPath, GatherTextConfigPath))
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Error, TEXT("No destination path specified."));
return false;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromAssetsCommandlet.cpp:1467
Scope (from outer to inner):
file
function bool UGatherTextFromAssetsCommandlet::ConfigureFromScript
Source code excerpt:
GetStringArrayFromConfig(*SectionName, TEXT("ModulesToPreload"), ModulesToPreload, GatherTextConfigPath);
// IncludePathFilters
GetPathArrayFromConfig(*SectionName, TEXT("IncludePathFilters"), IncludePathFilters, GatherTextConfigPath);
// IncludePaths (DEPRECATED)
{
TArray<FString> IncludePaths;
GetPathArrayFromConfig(*SectionName, TEXT("IncludePaths"), IncludePaths, GatherTextConfigPath);
if (IncludePaths.Num())
{
IncludePathFilters.Append(IncludePaths);
UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("IncludePaths detected in section %s. IncludePaths is deprecated, please use IncludePathFilters."), *SectionName);
}
}
if (IncludePathFilters.Num() == 0)
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Error, TEXT("No include path filters in section %s."), *SectionName);
bHasFatalError = true;
}
// Collections
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:88
Scope (from outer to inner):
file
function int32 UGatherTextFromMetaDataCommandlet::Main
Source code excerpt:
}
// IncludePathFilters
TArray<FString> IncludePathFilters;
GetPathArrayFromConfig(*SectionName, TEXT("IncludePathFilters"), IncludePathFilters, GatherTextConfigPath);
// IncludePaths (DEPRECATED)
{
TArray<FString> IncludePaths;
GetPathArrayFromConfig(*SectionName, TEXT("IncludePaths"), IncludePaths, GatherTextConfigPath);
if (IncludePaths.Num())
{
IncludePathFilters.Append(IncludePaths);
UE_LOG(LogGatherTextFromMetaDataCommandlet, Warning, TEXT("IncludePaths detected in section %s. IncludePaths is deprecated, please use IncludePathFilters."), *SectionName);
}
}
if (IncludePathFilters.Num() == 0)
{
UE_LOG(LogGatherTextFromMetaDataCommandlet, Error, TEXT("No include path filters in section %s."), *SectionName);
return -1;
}
// ExcludePathFilters
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:124
Scope (from outer to inner):
file
function int32 UGatherTextFromMetaDataCommandlet::Main
Source code excerpt:
}
FGatherTextDelegates::GetAdditionalGatherPaths.Broadcast(GatherManifestHelper->GetTargetName(), IncludePathFilters, ExcludePathFilters);
// Get whether we should gather editor-only data. Typically only useful for the localization of UE itself.
if (!GetBoolFromConfig(*SectionName, TEXT("ShouldGatherFromEditorOnlyData"), ShouldGatherFromEditorOnlyData, GatherTextConfigPath))
{
ShouldGatherFromEditorOnlyData = false;
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:267
Scope (from outer to inner):
file
function int32 UGatherTextFromMetaDataCommandlet::Main
Source code excerpt:
// Execute gather.
GatherTextFromUObjects(IncludePathFilters, ExcludePathFilters, Arguments);
// Add any manifest dependencies if they were provided
TArray<FString> ManifestDependenciesList;
GetPathArrayFromConfig(*SectionName, TEXT("ManifestDependencies"), ManifestDependenciesList, GatherTextConfigPath);
for (const FString& ManifestDependency : ManifestDependenciesList)
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:150
Scope (from outer to inner):
file
function int32 UGatherTextFromSourceCommandlet::Main
Source code excerpt:
// Build the final set of include/exclude paths to scan.
TArray<FString> IncludePathFilters;
Algo::Transform(SearchDirectoryPaths, IncludePathFilters, [](const FString& SearchDirectoryPath)
{
const TCHAR LastChar = SearchDirectoryPath.Len() > 0 ? SearchDirectoryPath[SearchDirectoryPath.Len() - 1] : 0;
return (LastChar == TEXT('*') || LastChar == TEXT('?'))
? SearchDirectoryPath // Already a wildcard
: FPaths::Combine(SearchDirectoryPath, TEXT("*")); // Add a catch-all wildcard
});
FGatherTextDelegates::GetAdditionalGatherPaths.Broadcast(GatherManifestHelper->GetTargetName(), IncludePathFilters, ExcludePathFilters);
// Search in the root folder for each of the wildcard filters specified and build a list of files
TArray<FString> FilesToProcess;
{
TArray<FString> RootSourceFiles;
TSet<FString, FLocKeySetFuncs> ProcessedSearchDirectoryPaths;
for (const FString& IncludePathFilter : IncludePathFilters)
{
constexpr FAsciiSet Wildcards("*?");
FString SearchDirectoryPath = IncludePathFilter;
if (const TCHAR* FirstWildcard = FAsciiSet::FindFirstOrEnd(*SearchDirectoryPath, Wildcards); *FirstWildcard != 0)
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:203
Scope (from outer to inner):
file
function int32 UGatherTextFromSourceCommandlet::Main
Source code excerpt:
}
const FFuzzyPathMatcher FuzzyPathMatcher = FFuzzyPathMatcher(IncludePathFilters, ExcludePathFilters);
FilesToProcess.RemoveAll([&FuzzyPathMatcher](const FString& FoundFile)
{
// Filter out assets whose package file paths do not pass the "fuzzy path" filters.
if (FuzzyPathMatcher.TestPath(FoundFile) != FFuzzyPathMatcher::EPathMatch::Included)
{
return true;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:219
Scope (from outer to inner):
file
function int32 UGatherTextFromSourceCommandlet::Main
Source code excerpt:
{
FString SpecifiedDirectoriesString;
for (const FString& IncludePath : IncludePathFilters)
{
SpecifiedDirectoriesString.Append(FString(SpecifiedDirectoriesString.IsEmpty() ? TEXT("") : TEXT("\n")) + FString::Printf(TEXT("+ %s"), *IncludePath));
}
for (const FString& ExcludePath : ExcludePathFilters)
{
SpecifiedDirectoriesString.Append(FString(SpecifiedDirectoriesString.IsEmpty() ? TEXT("") : TEXT("\n")) + FString::Printf(TEXT("- %s"), *ExcludePath));