ExcludePathFilters

ExcludePathFilters

#Overview

name: ExcludePathFilters

The value of this variable can be defined or overridden in .ini config files. 42 .ini config files referencing this setting variable.

It is referenced in 15 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ExcludePathFilters is to specify paths that should be excluded from text gathering operations in Unreal Engine’s localization system.

ExcludePathFilters is primarily used in the localization subsystem of Unreal Engine, specifically in the text gathering process. It is utilized by various commandlets and scripts related to localization, such as GatherTextFromAssetsCommandlet, GatherTextFromMetaDataCommandlet, and GatherTextFromSourceCommandlet.

The value of this variable is typically set in configuration files or scripts that define the localization gathering process. It can be set multiple times to exclude multiple paths.

ExcludePathFilters often interacts with IncludePathFilters. While IncludePathFilters specifies which paths to include in the gathering process, ExcludePathFilters defines which paths to exclude. The engine uses both of these to determine the final set of paths to process.

Developers must be aware that ExcludePathFilters is case-sensitive and uses wildcard patterns. It’s important to ensure that the paths specified are correct and don’t unintentionally exclude important content.

Best practices when using this variable include:

  1. Be as specific as possible to avoid accidentally excluding necessary content.
  2. Use in conjunction with IncludePathFilters for fine-grained control over what content is processed.
  3. Regularly review and update the excluded paths as the project structure changes.
  4. Be aware that some older scripts might use the deprecated “ExcludePaths” instead of “ExcludePathFilters”.
  5. When specifying paths, use relative paths from the project root or use appropriate tokens (like those provided by FLocalizationGatherPathRootUtil) to ensure portability across different development environments.

#Setting Variables

#References In INI files

<Workspace>/Engine/Config/Localization/Category.ini:35, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Category.ini:36, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:29, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:30, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:31, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:32, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:61, section: [GatherTextStep2]
<Workspace>/Engine/Config/Localization/Editor.ini:62, section: [GatherTextStep2]
<Workspace>/Engine/Config/Localization/Engine.ini:31, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:32, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:34, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:35, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:36, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:37, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:38, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:51, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Engine.ini:52, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Engine.ini:53, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Engine.ini:54, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Engine.ini:55, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Engine.ini:56, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Engine.ini:57, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Engine.ini:58, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Keywords.ini:30, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Keywords.ini:31, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/PropertyNames.ini:35, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/PropertyNames.ini:36, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/ToolTips.ini:35, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/ToolTips.ini:36, section: [GatherTextStep0]


... omitting 12 locations ...

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:340

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:


			// Exclude Paths
			ConfigSection.Add( TEXT("ExcludePathFilters"), TEXT("Config/Localization/*") );
			for (const auto& ExcludePath : Target->Settings.GatherFromTextFiles.ExcludePathWildcards)
			{
				ConfigSection.Add( TEXT("ExcludePathFilters"), FString::Printf(TEXT("%s%s"), *FLocalizationGatherPathRootUtil::GetResolvedPathRootToken(ExcludePath.PathRoot), *ExcludePath.Pattern) );
			}

			// Source File Search Filters
			for (const auto& FileExtension : Target->Settings.GatherFromTextFiles.FileExtensions)
			{
				ConfigSection.Add( TEXT("FileNameFilters"), FString::Printf( TEXT("*.%s"), *FileExtension.Pattern) );

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:372

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:


			// Exclude Paths
			ConfigSection.Add( TEXT("ExcludePathFilters"), TEXT("Content/Localization/*") );
			for (const auto& ExcludePath : Target->Settings.GatherFromPackages.ExcludePathWildcards)
			{
				ConfigSection.Add( TEXT("ExcludePathFilters"), FString::Printf(TEXT("%s%s"), *FLocalizationGatherPathRootUtil::GetResolvedPathRootToken(ExcludePath.PathRoot), *ExcludePath.Pattern) );
			}

			// Package Extensions
			for (const auto& FileExtension : Target->Settings.GatherFromPackages.FileExtensions)
			{
				ConfigSection.Add( TEXT("PackageFileNameFilters"), FString::Printf( TEXT("*.%s"), *FileExtension.Pattern) );

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:422

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:

			for (const auto& ExcludePath : Target->Settings.GatherFromMetaData.ExcludePathWildcards)
			{
				ConfigSection.Add( TEXT("ExcludePathFilters"), FString::Printf(TEXT("%s%s"), *FLocalizationGatherPathRootUtil::GetResolvedPathRootToken(ExcludePath.PathRoot), *ExcludePath.Pattern) );
			}

			// Key Specifications
			for (const FMetaDataKeyGatherSpecification& Specification : Target->Settings.GatherFromMetaData.KeySpecifications)
			{
				ConfigSection.Add( TEXT("InputKeys"), Specification.MetaDataKey.Name );

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/UserGeneratedContentLocalization.cpp:319

Scope (from outer to inner):

file
namespace    UserGeneratedContentLocalization
function     bool ExportLocalization

Source code excerpt:

				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()))
				{
					ConfigSection.Add(TEXT("CollectionFilters"), *CollectionFilter);
				}
				

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/UserGeneratedContentLocalization.cpp:338

Scope (from outer to inner):

file
namespace    UserGeneratedContentLocalization
function     bool ExportLocalization

Source code excerpt:

				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));
			}

			// Generate manifest
			{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Commandlets/GatherTextFromAssetsCommandlet.h:106

Scope (from outer to inner):

file
class        class UGatherTextFromAssetsCommandlet : public UGatherTextCommandletBase

Source code excerpt:

	TArray<FString> IncludePathFilters;
	TArray<FString> CollectionFilters;
	TArray<FString> ExcludePathFilters;
	TArray<FString> PackageFileNameFilters;
	TArray<FString> ExcludeClassNames;
	TArray<FString> ManifestDependenciesList;

	TArray<FPackagePendingGather> PackagesPendingGather;

#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:1502

Scope (from outer to inner):

file
function     bool UGatherTextFromAssetsCommandlet::ConfigureFromScript

Source code excerpt:

	}

	// ExcludePathFilters
	GetPathArrayFromConfig(*SectionName, TEXT("ExcludePathFilters"), ExcludePathFilters, GatherTextConfigPath);

	// ExcludePaths (DEPRECATED)
	{
		TArray<FString> ExcludePaths;
		GetPathArrayFromConfig(*SectionName, TEXT("ExcludePaths"), ExcludePaths, GatherTextConfigPath);
		if (ExcludePaths.Num())
		{
			ExcludePathFilters.Append(ExcludePaths);
			UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("ExcludePaths detected in section %s. ExcludePaths is deprecated, please use ExcludePathFilters."), *SectionName);
		}
	}

	// PackageNameFilters
	GetStringArrayFromConfig(*SectionName, TEXT("PackageFileNameFilters"), PackageFileNameFilters, GatherTextConfigPath);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:109

Scope (from outer to inner):

file
function     int32 UGatherTextFromMetaDataCommandlet::Main

Source code excerpt:

	}

	// ExcludePathFilters
	TArray<FString> ExcludePathFilters;
	GetPathArrayFromConfig(*SectionName, TEXT("ExcludePathFilters"), ExcludePathFilters, GatherTextConfigPath);

	// ExcludePaths (DEPRECATED)
	{
		TArray<FString> ExcludePaths;
		GetPathArrayFromConfig(*SectionName, TEXT("ExcludePaths"), ExcludePaths, GatherTextConfigPath);
		if (ExcludePaths.Num())
		{
			ExcludePathFilters.Append(ExcludePaths);
			UE_LOG(LogGatherTextFromMetaDataCommandlet, Warning, TEXT("ExcludePaths detected in section %s. ExcludePaths is deprecated, please use ExcludePathFilters."), *SectionName);
		}
	}

	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:106

Scope (from outer to inner):

file
function     int32 UGatherTextFromSourceCommandlet::Main

Source code excerpt:

	}

	// ExcludePathFilters
	TArray<FString> ExcludePathFilters;
	GetPathArrayFromConfig(*SectionName, TEXT("ExcludePathFilters"), ExcludePathFilters, GatherTextConfigPath);

	// ExcludePaths (DEPRECATED)
	{
		TArray<FString> ExcludePaths;
		GetPathArrayFromConfig(*SectionName, TEXT("ExcludePaths"), ExcludePaths, GatherTextConfigPath);
		if (ExcludePaths.Num())
		{
			ExcludePathFilters.Append(ExcludePaths);
			UE_LOG(LogGatherTextFromSourceCommandlet, Warning, TEXT("ExcludePaths detected in section %s. ExcludePaths is deprecated, please use ExcludePathFilters."), *SectionName);
		}
	}

	// FileNameFilters
	TArray<FString> FileNameFilters;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:159

Scope (from outer to inner):

file
function     int32 UGatherTextFromSourceCommandlet::Main

Source code excerpt:

	});

	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;

#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:223

Scope (from outer to inner):

file
function     int32 UGatherTextFromSourceCommandlet::Main

Source code excerpt:

			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));
		}

		FString SourceFileSearchFiltersString;
		for (const FString& Filter : UniqueSourceFileSearchFilters)