SearchDirectoryPaths
SearchDirectoryPaths
#Overview
name: SearchDirectoryPaths
The value of this variable can be defined or overridden in .ini config files. 25
.ini config files referencing this setting variable.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of SearchDirectoryPaths is to define the directories that should be searched for localization-related content in Unreal Engine 5. This setting variable is primarily used in the localization system to specify where to look for text that needs to be localized.
SearchDirectoryPaths is utilized by the localization subsystem and the GatherTextFromSource commandlet. It’s primarily referenced in the Localization module and the UnrealEd module.
The value of this variable is typically set in configuration files or through code when generating localization configuration. It can be populated from various sources, such as target settings, plugin directories, or manually specified paths.
SearchDirectoryPaths often interacts with other localization-related variables like ExcludePathFilters and FileNameFilters to define the scope of the text gathering process.
Developers should be aware that:
- This variable is crucial for determining which directories are scanned for localizable content.
- It supports wildcard patterns for more flexible directory specification.
- Empty SearchDirectoryPaths can lead to warnings or errors in the localization process.
Best practices when using this variable include:
- Ensure all relevant directories containing localizable content are included.
- Use relative paths when possible to maintain portability across different development environments.
- Be specific with directory paths to avoid unnecessary scanning of irrelevant folders, which can impact performance.
- Regularly review and update the paths as the project structure evolves.
- Consider using the FLocalizationGatherPathRootUtil when constructing paths to ensure proper resolution of root tokens.
#Setting Variables
#References In INI files
<Workspace>/Engine/Config/Localization/Editor.ini:27, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:28, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:27, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:28, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:29, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:30, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/Android/OnlineSubsystemGooglePlay/Config/Localization/OnlineSubsystemGooglePlay.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/IOS/OnlineSubsystemIOS/Config/Localization/OnlineSubsystemIOS.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineFramework/Config/Localization/OnlineFramework.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystem/Config/Localization/OnlineSubsystem.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemAmazon/Config/Localization/OnlineSubsystemAmazon.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Config/Localization/OnlineSubsystemFacebook.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemOculus/Config/Localization/OnlineSubsystemOculus.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Config/Localization/OnlineSubsystemSteam.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Config/Localization/OnlineSubsystemUtils.ini:26, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Runtime/HTTPChunkInstaller/Config/Localization/HTTPChunkInstaller.ini:26, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/EngineOverrides_Gather.ini:26, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/EngineOverrides_Gather.ini:27, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/EngineOverrides_Gather.ini:28, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/EngineOverrides_Gather.ini:29, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:28, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:29, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:30, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:31, section: [GatherTextStep0]
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:336
Scope (from outer to inner):
file
namespace LocalizationConfigurationScript
function FLocalizationConfigurationScript GenerateGatherTextConfigFile
Source code excerpt:
for (const auto& IncludePath : Target->Settings.GatherFromTextFiles.SearchDirectories)
{
ConfigSection.Add( TEXT("SearchDirectoryPaths"), FString::Printf(TEXT("%s%s"), *FLocalizationGatherPathRootUtil::GetResolvedPathRootToken(IncludePath.PathRoot), *IncludePath.Path) );
}
// Exclude Paths
ConfigSection.Add( TEXT("ExcludePathFilters"), TEXT("Config/Localization/*") );
for (const auto& ExcludePath : Target->Settings.GatherFromTextFiles.ExcludePathWildcards)
{
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/UserGeneratedContentLocalization.cpp:278
Scope (from outer to inner):
file
namespace UserGeneratedContentLocalization
function bool ExportLocalization
Source code excerpt:
const FString PluginSourceDir = FPaths::ConvertRelativePathToFull(FPaths::Combine(Plugin->GetBaseDir(), TEXT("Source")));
TArray<FString, TInlineAllocator<2>> SearchDirectoryPaths;
if (FPaths::DirectoryExists(PluginConfigDir))
{
SearchDirectoryPaths.Add(PluginConfigDir);
}
if (FPaths::DirectoryExists(PluginSourceDir))
{
SearchDirectoryPaths.Add(PluginSourceDir);
}
// Only gather from source if there's valid paths to gather from, as otherwise the commandlet will error
if (SearchDirectoryPaths.Num() > 0)
{
FConfigSection ConfigSection;
ConfigSection.Add(TEXT("CommandletClass"), TEXT("GatherTextFromSource"));
ConfigSection.Add(TEXT("FileNameFilters"), TEXT("*.h"));
ConfigSection.Add(TEXT("FileNameFilters"), TEXT("*.cpp"));
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/UserGeneratedContentLocalization.cpp:299
Scope (from outer to inner):
file
namespace UserGeneratedContentLocalization
function bool ExportLocalization
Source code excerpt:
ConfigSection.Add(TEXT("FileNameFilters"), TEXT("*.ini"));
for (const FString& SearchDirectoryPath : SearchDirectoryPaths)
{
ConfigSection.Add(TEXT("SearchDirectoryPaths"), SearchDirectoryPath);
}
GatherConfig.AddGatherTextStep(GatherStepIndex++, MoveTemp(ConfigSection));
}
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:85
Scope (from outer to inner):
file
function int32 UGatherTextFromSourceCommandlet::Main
Source code excerpt:
}
// SearchDirectoryPaths
TArray<FString> SearchDirectoryPaths;
GetPathArrayFromConfig(*SectionName, TEXT("SearchDirectoryPaths"), SearchDirectoryPaths, GatherTextConfigPath);
// IncludePaths (DEPRECATED)
{
TArray<FString> IncludePaths;
GetPathArrayFromConfig(*SectionName, TEXT("IncludePaths"), IncludePaths, GatherTextConfigPath);
if (IncludePaths.Num())
{
SearchDirectoryPaths.Append(IncludePaths);
UE_LOG(LogGatherTextFromSourceCommandlet, Warning, TEXT("IncludePaths detected in section %s. IncludePaths is deprecated, please use SearchDirectoryPaths."), *SectionName);
}
}
if (SearchDirectoryPaths.Num() == 0)
{
UE_LOG(LogGatherTextFromSourceCommandlet, Warning, TEXT("No search directory paths in section %s."), *SectionName);
return 0;
}
// ExcludePathFilters
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:151
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
});