DataPath
DataPath
#Overview
name: DataPath
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 45
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of DataPath is to specify the directory where Unreal Engine’s Zen server stores its data. Zen is a caching and storage system used by Unreal Engine for various purposes, including the Derived Data Cache (DDC).
Key points about DataPath:
-
It’s used primarily in the Zen subsystem, which is part of Unreal Engine’s caching and storage infrastructure.
-
The value of DataPath is typically set through configuration files, environment variables, or command-line arguments, with a hierarchy of preferences for these sources.
-
It’s used when launching the Zen server, determining where to store and retrieve cached data.
-
The DataPath is crucial for the Zen server’s operation, as it determines where lock files are created and where log files are stored.
-
It’s used in various Unreal Engine subsystems, including the Derived Data Cache (DDC) and potentially online subsystems like Tencent’s.
Developers should be aware that:
-
The DataPath should be set to a location with sufficient disk space and appropriate permissions.
-
Changing the DataPath can affect the performance of the engine, as it may result in cache misses if the new location doesn’t contain previously cached data.
-
In multi-user or networked environments, care should be taken to ensure that the DataPath is set appropriately to avoid conflicts or permission issues.
-
The DataPath can be overridden in various ways, so developers should be aware of the precedence of different configuration methods.
Best practices include:
-
Using a consistent DataPath across a project to ensure optimal caching performance.
-
Ensuring the DataPath is set to a location with sufficient disk space and appropriate read/write permissions.
-
In team environments, coordinating the DataPath setting to ensure consistency across different development machines.
-
Regularly monitoring and managing the contents of the DataPath directory to prevent excessive disk usage.
-
When deploying builds or sharing projects, considering whether to include or exclude the contents of the DataPath, depending on the specific needs of the project and team.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2437, section: [Zen.AutoLaunch]
- INI Section:
Zen.AutoLaunch
- Raw value:
%ENGINEVERSIONAGNOSTICINSTALLEDUSERDIR%Zen/Data
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemTencent/Source/Private/OnlineSubsystemTencent.cpp:1207
Scope (from outer to inner):
file
function bool FOnlineSubsystemTencent::HandleRailSdkWrapperPlayerExecCommands
Source code excerpt:
rail::RailString RailDataPath;
rail::RailResult RailDataPathResult = Player->GetPlayerDataPath(&RailDataPath);
FString DataPath = LexToString(RailDataPath);
const rail::EnumRailPlayerOwnershipType OwnershipType = Player->GetPlayerOwnershipType();
UE_LOG_ONLINE(Display, TEXT("ID: %llu (domain %u)"), RailId.get_id(), static_cast<uint32>(RailId.GetDomain()));
UE_LOG_ONLINE(Display, TEXT("Name: '%s' (result %s)"), *PlayerName, *LexToString(RailPlayerNameResult));
UE_LOG_ONLINE(Display, TEXT("Logged in: %s"), LoggedInLogString);
UE_LOG_ONLINE(Display, TEXT("DataPath: '%s' (result %s)"), *DataPath, *LexToString(RailDataPathResult));
UE_LOG_ONLINE(Display, TEXT("OwnershipType: %u"), static_cast<uint32>(OwnershipType));
}
else if (FParse::Command(&Cmd, TEXT("ACQUIRESESSIONTICKET")))
{
const rail::RailID RailId = Player->GetRailID();
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:621
Scope (from outer to inner):
file
namespace UE::DerivedData
function bool FHttpCacheStoreTest::RunTest
Source code excerpt:
FServiceSettings ZenUpstreamTestServiceSettings;
FServiceAutoLaunchSettings& ZenUpstreamTestAutoLaunchSettings = ZenUpstreamTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenUpstreamTestAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUpstreamUnitTest"));
ZenUpstreamTestAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-jupiter-url \"%s\" --upstream-jupiter-token \"%s\" --upstream-jupiter-namespace \"%s\""),
*TestDomain,
*TestAccessToken,
*TestNamespace
);
ZenUpstreamTestAutoLaunchSettings.DesiredPort = 23337; // Avoid the normal default port
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:635
Scope (from outer to inner):
file
namespace UE::DerivedData
function bool FHttpCacheStoreTest::RunTest
Source code excerpt:
FServiceSettings ZenUpstreamSiblingTestServiceSettings;
FServiceAutoLaunchSettings& ZenUpstreamSiblingTestAutoLaunchSettings = ZenUpstreamSiblingTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenUpstreamSiblingTestAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUpstreamSiblingUnitTest"));
ZenUpstreamSiblingTestAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-jupiter-url \"%s\" --upstream-jupiter-token \"%s\" --upstream-jupiter-namespace \"%s\""),
*TestDomain,
*TestAccessToken,
*TestNamespace
);
ZenUpstreamSiblingTestAutoLaunchSettings.DesiredPort = 23338; // Avoid the normal default port
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:648
Scope (from outer to inner):
file
namespace UE::DerivedData
function bool FHttpCacheStoreTest::RunTest
Source code excerpt:
FServiceSettings ZenTestServiceSettings;
FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenTestAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUnitTest"));
ZenTestAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-zen-url \"http://localhost:%d\""),
ScopeZenUpstreamService.GetInstance().GetPort()
);
ZenTestAutoLaunchSettings.DesiredPort = 13337; // Avoid the normal default port
ZenTestAutoLaunchSettings.bShowConsole = true;
ZenTestAutoLaunchSettings.bLimitProcessLifetime = true;
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:659
Scope (from outer to inner):
file
namespace UE::DerivedData
function bool FHttpCacheStoreTest::RunTest
Source code excerpt:
FServiceSettings ZenTestServiceSiblingSettings;
FServiceAutoLaunchSettings& ZenTestSiblingAutoLaunchSettings = ZenTestServiceSiblingSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenTestSiblingAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUnitTestSibling"));
ZenTestSiblingAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-zen-url \"http://localhost:%d\""),
ScopeZenUpstreamSiblingService.GetInstance().GetPort()
);
ZenTestSiblingAutoLaunchSettings.DesiredPort = 13338; // Avoid the normal default port
ZenTestSiblingAutoLaunchSettings.bShowConsole = true;
ZenTestSiblingAutoLaunchSettings.bLimitProcessLifetime = true;
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/ZenCacheStore.cpp:2152
Scope (from outer to inner):
file
namespace UE::DerivedData
function ILegacyCacheStore* CreateZenCacheStore
Source code excerpt:
AutoLaunchSettings.DesiredPort++;
FPaths::NormalizeDirectoryName(AutoLaunchSettings.DataPath);
AutoLaunchSettings.DataPath += TEXT("_");
AutoLaunchSettings.DataPath += Params.Sandbox;
AutoLaunchSettings.bIsDefaultSharedRunContext = false;
// The unique local instances will always limit process lifetime for now to avoid accumulating many of them
AutoLaunchSettings.bLimitProcessLifetime = true;
// Flush the cache if requested.
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/ZenCacheStore.cpp:2165
Scope (from outer to inner):
file
namespace UE::DerivedData
function ILegacyCacheStore* CreateZenCacheStore
Source code excerpt:
{
bool bStopped = true;
if (UE::Zen::IsLocalServiceRunning(*AutoLaunchSettings.DataPath))
{
bStopped = UE::Zen::StopLocalService(*AutoLaunchSettings.DataPath);
}
if (bStopped)
{
IFileManager::Get().DeleteDirectory(*(AutoLaunchSettings.DataPath / TEXT("")), /*bRequireExists*/ false, /*bTree*/ true);
}
else
{
UE_LOG(LogDerivedDataCache, Warning, TEXT("%s: Zen DDC could not be flushed due to an existing instance not shutting down when requested."), NodeName);
}
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:572
Scope (from outer to inner):
file
namespace UE::Zen
function static void DetermineLocalDataCachePath
Source code excerpt:
static void
DetermineLocalDataCachePath(const TCHAR* ConfigSection, FString& DataPath)
{
FString DataPathEnvOverride;
if (GConfig->GetString(ConfigSection, TEXT("LocalDataCachePathEnvOverride"), DataPathEnvOverride, GEngineIni))
{
FString DataPathEnvOverrideValue = FPlatformMisc::GetEnvironmentVariable(*DataPathEnvOverride);
if (!DataPathEnvOverrideValue.IsEmpty())
{
DataPath = DataPathEnvOverrideValue;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found environment variable %s=%s"), *DataPathEnvOverride, *DataPathEnvOverrideValue);
}
if (FPlatformMisc::GetStoredValue(TEXT("Epic Games"), TEXT("GlobalDataCachePath"), *DataPathEnvOverride, DataPathEnvOverrideValue))
{
if (!DataPathEnvOverrideValue.IsEmpty())
{
DataPath = DataPathEnvOverrideValue;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found registry key GlobalDataCachePath %s=%s"), *DataPathEnvOverride, *DataPath);
}
}
}
FString DataPathCommandLineOverride;
if (GConfig->GetString(ConfigSection, TEXT("LocalDataCachePathCommandLineOverride"), DataPathCommandLineOverride, GEngineIni))
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:600
Scope (from outer to inner):
file
namespace UE::Zen
function static void DetermineLocalDataCachePath
Source code excerpt:
if (FParse::Value(FCommandLine::Get(), *(DataPathCommandLineOverride + TEXT("=")), DataPathCommandLineOverrideValue))
{
DataPath = DataPathCommandLineOverrideValue;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found command line override %s=%s"), *DataPathCommandLineOverride, *DataPath);
}
}
// Paths starting with a '?' are looked up from config
if (DataPath.StartsWith(TEXT("?")) && !GConfig->GetString(TEXT("DerivedDataCacheSettings"), *DataPath + 1, DataPath, GEngineIni))
{
DataPath.Empty();
}
FString DataPathEditorOverrideSetting;
if (GConfig->GetString(ConfigSection, TEXT("LocalDataCachePathEditorOverrideSetting"), DataPathEditorOverrideSetting, GEngineIni))
{
EnsureEditorSettingsConfigLoaded();
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:625
Scope (from outer to inner):
file
namespace UE::Zen
function static void DetermineLocalDataCachePath
Source code excerpt:
if (!SettingPath.IsEmpty())
{
DataPath = SettingPath;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found editor setting /Script/UnrealEd.EditorSettings.Path=%s"), *DataPath);
}
}
}
}
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:640
Scope (from outer to inner):
file
namespace UE::Zen
function static bool DetermineDataPath
Source code excerpt:
static bool
DetermineDataPath(const TCHAR* ConfigSection, FString& DataPath, bool& bHasInvalidPathConfigurations, bool& bIsDefaultDataPath)
{
auto ValidateDataPath = [](const FString& InDataPath)
{
if (InDataPath.IsEmpty())
{
return FString{};
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:678
Scope (from outer to inner):
file
namespace UE::Zen
function static bool DetermineDataPath
Source code excerpt:
if (FString Path = ValidateDataPath(CommandLineOverrideValue); !Path.IsEmpty())
{
DataPath = Path;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found command line override ZenDataPath=%s"), *CommandLineOverrideValue);
return true;
}
UE_LOG(LogZenServiceInstance, Warning, TEXT("Skipping command line override ZenDataPath=%s due to an invalid path"), *CommandLineOverrideValue);
bHasInvalidPathConfigurations = true;
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:691
Scope (from outer to inner):
file
namespace UE::Zen
function static bool DetermineDataPath
Source code excerpt:
if (FString Path = ValidateDataPath(SubprocessDataPathEnvOverrideValue); !Path.IsEmpty())
{
DataPath = Path;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found subprocess environment variable UE-ZenSubprocessDataPath=%s"), *SubprocessDataPathEnvOverrideValue);
return true;
}
UE_LOG(LogZenServiceInstance, Warning, TEXT("Skipping subprocess environment variable UE-ZenSubprocessDataPath=%s due to an invalid path"), *SubprocessDataPathEnvOverrideValue);
bHasInvalidPathConfigurations = true;
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:705
Scope (from outer to inner):
file
namespace UE::Zen
function static bool DetermineDataPath
Source code excerpt:
if (FString Path = ValidateDataPath(DataPathEnvOverrideValue); !Path.IsEmpty())
{
DataPath = Path;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found registry key Zen DataPath=%s"), *DataPathEnvOverrideValue);
return true;
}
UE_LOG(LogZenServiceInstance, Warning, TEXT("Skipping registry key Zen DataPath=%s due to an invalid path"), *DataPathEnvOverrideValue);
bHasInvalidPathConfigurations = true;
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:718
Scope (from outer to inner):
file
namespace UE::Zen
function static bool DetermineDataPath
Source code excerpt:
if (FString Path = ValidateDataPath(ZenDataPathEnvOverrideValue); !Path.IsEmpty())
{
DataPath = Path;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found environment variable UE-ZenDataPath=%s"), *ZenDataPathEnvOverrideValue);
return true;
}
UE_LOG(LogZenServiceInstance, Warning, TEXT("Skipping environment variable UE-ZenDataPath=%s due to an invalid path"), *ZenDataPathEnvOverrideValue);
bHasInvalidPathConfigurations = true;
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:734
Scope (from outer to inner):
file
namespace UE::Zen
function static bool DetermineDataPath
Source code excerpt:
if (FString Path = ValidateDataPath(ZenLocalDataCachePath); !Path.IsEmpty())
{
DataPath = Path;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found local data cache path=%s"), *LocalDataCachePath);
return true;
}
UE_LOG(LogZenServiceInstance, Warning, TEXT("Skipping local data cache path=%s due to an invalid path"), *LocalDataCachePath);
bHasInvalidPathConfigurations = true;
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:744
Scope (from outer to inner):
file
namespace UE::Zen
function static bool DetermineDataPath
Source code excerpt:
// Zen config default
FString ConfigDefaultPath;
GConfig->GetString(ConfigSection, TEXT("DataPath"), ConfigDefaultPath, GEngineIni);
if (!ConfigDefaultPath.IsEmpty())
{
ConfigDefaultPath.ReplaceInline(TEXT("%ENGINEVERSIONAGNOSTICINSTALLEDUSERDIR%"), *GetLocalZenRootPath());
if (FString Path = ValidateDataPath(ConfigDefaultPath); !Path.IsEmpty())
{
DataPath = Path;
bIsDefaultDataPath = true;
UE_LOG(LogZenServiceInstance, Log, TEXT("Found Zen config default=%s"), *ConfigDefaultPath);
return true;
}
UE_LOG(LogZenServiceInstance, Warning, TEXT("Skipping Zen config default=%s due to an invalid path"), *ConfigDefaultPath);
bHasInvalidPathConfigurations = true;
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:900
Scope (from outer to inner):
file
namespace UE::Zen
function bool FServiceSettings::ReadFromConfig
Source code excerpt:
bool bHasInvalidPathConfigurations = false;
if (!DetermineDataPath(AutoLaunchConfigSection, AutoLaunchSettings.DataPath, bHasInvalidPathConfigurations, AutoLaunchSettings.bIsDefaultDataPath))
{
PromptUserUnableToDetermineValidDataPath();
return false;
}
else if (bHasInvalidPathConfigurations)
{
PromptUserAboutInvalidValidDataPathConfiguration(AutoLaunchSettings.DataPath);
}
#if PLATFORM_WINDOWS
{
int32 DriveEnd = 0;
if (AutoLaunchSettings.DataPath.FindChar(':', DriveEnd))
{
FString DrivePath = AutoLaunchSettings.DataPath.Left(DriveEnd + 1);
TCHAR VolumeName[128];
BOOL OK = GetVolumeInformation(
*DrivePath,
VolumeName,
127,
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:975
Scope (from outer to inner):
file
namespace UE::Zen
function bool FServiceSettings::ReadFromCompactBinary
Source code excerpt:
if (FCbObjectView AutoLaunchSettingsObject = Field["AutoLaunchSettings"].AsObjectView())
{
AutoLaunchSettings.DataPath = FString(AutoLaunchSettingsObject["DataPath"].AsString());
AutoLaunchSettings.ExtraArgs = FString(AutoLaunchSettingsObject["ExtraArgs"].AsString());
AutoLaunchSettings.DesiredPort = AutoLaunchSettingsObject["DesiredPort"].AsInt16();
AutoLaunchSettings.bShowConsole = AutoLaunchSettingsObject["ShowConsole"].AsBool();
AutoLaunchSettings.bIsDefaultDataPath = AutoLaunchSettingsObject["IsDefaultDataPath"].AsBool();
AutoLaunchSettings.bLimitProcessLifetime = AutoLaunchSettingsObject["LimitProcessLifetime"].AsBool();
ApplyProcessLifetimeOverride(AutoLaunchSettings.bLimitProcessLifetime);
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1036
Scope (from outer to inner):
file
namespace UE::Zen
function void FServiceSettings::WriteToCompactBinary
Source code excerpt:
const FServiceAutoLaunchSettings& AutoLaunchSettings = SettingsVariant.Get<FServiceAutoLaunchSettings>();
Writer.BeginObject("AutoLaunchSettings");
Writer << "DataPath" << AutoLaunchSettings.DataPath;
Writer << "ExtraArgs" <<AutoLaunchSettings.ExtraArgs;
Writer << "DesiredPort" << AutoLaunchSettings.DesiredPort;
Writer << "ShowConsole" << AutoLaunchSettings.bShowConsole;
Writer << "IsDefaultDataPath" << AutoLaunchSettings.bIsDefaultDataPath;
Writer << "LimitProcessLifetime" << AutoLaunchSettings.bLimitProcessLifetime;
Writer << "SendUnattendedBugReports" << AutoLaunchSettings.bSendUnattendedBugReports;
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1472
Scope (from outer to inner):
file
namespace UE::Zen
function static bool ShutDownZenServerProcessLockingDataDir
Source code excerpt:
}
static bool ShutDownZenServerProcessLockingDataDir(const FString& DataPath, double MaximumWaitDurationSeconds = 25.0)
{
const FString LockFilePath = FPaths::Combine(DataPath, TEXT(".lock"));
uint64 ZenShutdownWaitStartTime = FPlatformTime::Cycles64();
if (!IsLockFileLocked(*LockFilePath, true))
{
UE_LOG(LogZenServiceInstance, Display, TEXT("Lock file '%s' is not active, nothing to do"), *LockFilePath);
return true;
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1600
Scope (from outer to inner):
file
namespace UE::Zen
function static FString DetermineCmdLineWithoutTransientComponents
Source code excerpt:
DetermineCmdLineWithoutTransientComponents(const FServiceAutoLaunchSettings& InSettings, int16 OverrideDesiredPort)
{
FString PlatformDataPath(InSettings.DataPath);
FPaths::MakePlatformFilename(PlatformDataPath);
FString Parms;
Parms.Appendf(TEXT("--port %d --data-dir \"%s\""),
OverrideDesiredPort,
*PlatformDataPath);
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1657
Scope (from outer to inner):
file
namespace UE::Zen
function bool Private::GetLocalDataCachePathOverride
Source code excerpt:
{
const TCHAR* AutoLaunchConfigSection = TEXT("Zen.AutoLaunch");
FString DataPath;
DetermineLocalDataCachePath(AutoLaunchConfigSection, DataPath);
if (DataPath.IsEmpty())
{
return false;
}
OutDataPath = DataPath;
return true;
}
bool
TryGetLocalServiceRunContext(FZenLocalServiceRunContext& OutContext)
{
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1680
Scope (from outer to inner):
file
namespace UE::Zen
function bool FZenLocalServiceRunContext::ReadFromJson
Source code excerpt:
CommandlineArguments = JsonObject.Values.FindRef(TEXT("CommandlineArguments"))->AsString();
WorkingDirectory = JsonObject.Values.FindRef(TEXT("WorkingDirectory"))->AsString();
DataPath = JsonObject.Values.FindRef(TEXT("DataPath"))->AsString();
bShowConsole = JsonObject.Values.FindRef(TEXT("ShowConsole"))->AsBool();
return true;
}
void
FZenLocalServiceRunContext::WriteToJson(TJsonWriter<TCHAR, TPrettyJsonPrintPolicy<TCHAR>>& Writer) const
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1691
Scope (from outer to inner):
file
namespace UE::Zen
function void FZenLocalServiceRunContext::WriteToJson
Source code excerpt:
Writer.WriteValue(TEXT("CommandlineArguments"), CommandlineArguments);
Writer.WriteValue(TEXT("WorkingDirectory"), WorkingDirectory);
Writer.WriteValue(TEXT("DataPath"), DataPath);
Writer.WriteValue(TEXT("ShowConsole"), bShowConsole);
}
bool
FZenLocalServiceRunContext::ReadFromJsonFile(const TCHAR* Filename)
{
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1733
Scope (from outer to inner):
file
namespace UE::Zen
function bool IsLocalServiceRunning
Source code excerpt:
bool
IsLocalServiceRunning(const TCHAR* DataPath, uint16* OutEffectivePort)
{
const FString LockFilePath = FPaths::Combine(DataPath, TEXT(".lock"));
LockFileData LockFileState;
if (IsZenProcessUsingDataDir(*LockFilePath, &LockFileState))
{
if (OutEffectivePort != nullptr && LockFileState.IsValid && LockFileState.IsReady)
{
*OutEffectivePort = LockFileState.EffectivePort;
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1832
Scope (from outer to inner):
file
namespace UE::Zen
function bool StopLocalService
Source code excerpt:
bool
StopLocalService(const TCHAR* DataPath, double MaximumWaitDurationSeconds)
{
const FString LockFilePath = FPaths::Combine(DataPath, TEXT(".lock"));
LockFileData LockFileState;
if (IsLockFileLocked(*LockFilePath, true))
{
return ShutDownZenServerProcessLockingDataDir(DataPath, MaximumWaitDurationSeconds);
}
return true;
}
FString
GetLocalServiceInstallVersion(bool bDetailed)
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1926
Scope (from outer to inner):
file
namespace UE::Zen
function FZenServiceInstance::FZenServiceInstance
Source code excerpt:
{
// Ensure that the zen data path is inherited by subprocesses
FPlatformMisc::SetEnvironmentVar(TEXT("UE-ZenSubprocessDataPath"), *Settings.SettingsVariant.Get<FServiceAutoLaunchSettings>().DataPath);
}
}
else
{
Settings.ReadFromURL(InstanceURL);
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1951
Scope (from outer to inner):
file
namespace UE::Zen
function const FString FZenServiceInstance::GetPath
Source code excerpt:
if (Settings.IsAutoLaunch())
{
return Settings.SettingsVariant.Get<FServiceAutoLaunchSettings>().DataPath;
}
return GetURL();
}
bool
FZenServiceInstance::IsServiceRunning()
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2191
Scope (from outer to inner):
file
namespace UE::Zen
function static void PromptUserOfLockedDataFolder
Source code excerpt:
static void
PromptUserOfLockedDataFolder(const FString& DataPath)
{
#if !IS_PROGRAM
if (!FApp::IsUnattended() && !IsRunningCommandlet() && !GIsRunningUnattendedScript)
{
FText ZenLaunchFailurePromptTitle = NSLOCTEXT("Zen", "Zen_NonLocalProcessUsesDataDirPromptTitle", "Failed to launch");
FText ZenLaunchFailurePromptText = FText::Format(NSLOCTEXT("Zen", "Zen_NonLocalProcessUsesDataDirPromptText", "Unreal Zen Storage Server Failed to auto launch, an unknown process is locking the data folder '{0}'"), FText::FromString(DataPath));
FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, *ZenLaunchFailurePromptText.ToString(), *ZenLaunchFailurePromptTitle.ToString());
}
else
#endif
{
// Just log as there is no one to show a message
UE_LOG(LogZenServiceInstance, Warning, TEXT("Unreal Zen Storage Server Failed to auto launch, an unknown process is locking the data folder '%s'"), *DataPath);
}
}
static void
PromptUserOfFailedShutDownOfExistingProcess(uint16 Port)
{
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2291
Scope (from outer to inner):
file
namespace UE::Zen
function bool FZenServiceInstance::AutoLaunch
Source code excerpt:
{
IFileManager& FileManager = IFileManager::Get();
const FString LockFilePath = FPaths::Combine(InSettings.DataPath, TEXT(".lock"));
const FString ExecutionContextFilePath = FPaths::SetExtension(ExecutablePath, TEXT(".runcontext"));
FString WorkingDirectory = FPaths::GetPath(ExecutablePath);
LockFileData LockFileState;
uint64 ZenWaitForRunningProcessReadyStartTime = FPlatformTime::Cycles64();
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2330
Scope (from outer to inner):
file
namespace UE::Zen
function bool FZenServiceInstance::AutoLaunch
Source code excerpt:
DesiredRunContext.CommandlineArguments = DetermineCmdLineWithoutTransientComponents(InSettings, InSettings.DesiredPort);
DesiredRunContext.WorkingDirectory = WorkingDirectory;
DesiredRunContext.DataPath = InSettings.DataPath;
DesiredRunContext.bShowConsole = InSettings.bShowConsole;
FZenLocalServiceRunContext CurrentRunContext;
bool ReadCurrentContextOK = CurrentRunContext.ReadFromJsonFile(*ExecutionContextFilePath);
if (ReadCurrentContextOK && (DesiredRunContext == CurrentRunContext))
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2393
Scope (from outer to inner):
file
namespace UE::Zen
function bool FZenServiceInstance::AutoLaunch
Source code excerpt:
if (bShutDownExistingInstanceForDataPath)
{
if (!ShutDownZenServerProcessLockingDataDir(InSettings.DataPath))
{
PromptUserOfFailedShutDownOfExistingProcess(InSettings.DesiredPort);
return false;
}
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2429
Scope (from outer to inner):
file
namespace UE::Zen
function bool FZenServiceInstance::AutoLaunch
Source code excerpt:
{
const FString InUseLockFilePath = FPaths::Combine(InUseDefaultDataPath, TEXT(".lock"));
if (!FPaths::IsSamePath(InUseDefaultDataPath, InSettings.DataPath) && !IsZenProcessUsingDataDir(*InUseLockFilePath, nullptr))
{
UE_LOG(LogZenServiceInstance, Display, TEXT("Migrating default data path from '%s' to '%s'. Old location will be deleted."), *InUseDefaultDataPath, *InSettings.DataPath);
IFileManager::Get().DeleteDirectory(*InUseDefaultDataPath, false, true);
}
}
}
FString ParmsWithoutTransients = DetermineCmdLineWithoutTransientComponents(InSettings, InSettings.DesiredPort);
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2449
Scope (from outer to inner):
file
namespace UE::Zen
function bool FZenServiceInstance::AutoLaunch
Source code excerpt:
EffectiveRunContext.CommandlineArguments = ParmsWithoutTransients;
EffectiveRunContext.WorkingDirectory = WorkingDirectory;
EffectiveRunContext.DataPath = InSettings.DataPath;
EffectiveRunContext.bShowConsole = InSettings.bShowConsole;
FProcHandle Proc = StartLocalService(EffectiveRunContext, TransientParms.IsEmpty() ? nullptr : *TransientParms);
// Only write run context if we're using the default shared run context
if (InSettings.bIsDefaultSharedRunContext)
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2482
Scope (from outer to inner):
file
namespace UE::Zen
function bool FZenServiceInstance::AutoLaunch
Source code excerpt:
if (InSettings.bIsDefaultDataPath && InSettings.bIsDefaultSharedRunContext)
{
GConfig->SetString(TEXT("/Script/UnrealEd.ZenServerSettings"), TEXT("InUseDefaultDataPath"), *InSettings.DataPath, GEditorSettingsIni);
}
OutHostName = TEXT("[::1]");
// Default to assuming that we get to run on the port we want
OutPort = InSettings.DesiredPort;
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:2529
Scope (from outer to inner):
file
function bool FZenServiceInstance::AutoLaunch
Source code excerpt:
FFormatNamedArguments FormatArguments;
FString LogFilePath = FPaths::Combine(InSettings.DataPath, TEXT("logs"), TEXT("zenserver.log"));
FPaths::MakePlatformFilename(LogFilePath);
FormatArguments.Add(TEXT("LogFilePath"), FText::FromString(LogFilePath));
FText ZenLaunchFailurePromptText = FText::Format(NSLOCTEXT("Zen", "Zen_LaunchFailurePromptText", "Unreal Zen Storage Server failed to launch. Please check the ZenServer log file for details:\n{LogFilePath}"), FormatArguments);
FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, *ZenLaunchFailurePromptText.ToString(), *ZenLaunchFailurePromptTitle.ToString());
return false;
}
#Loc: <Workspace>/Engine/Source/Developer/Zen/Public/Experimental/ZenServerInterface.h:38
Scope (from outer to inner):
file
namespace UE::Zen
Source code excerpt:
struct FServiceAutoLaunchSettings
{
FString DataPath;
FString ExtraArgs;
uint16 DesiredPort = 8558;
bool bShowConsole = false;
bool bIsDefaultDataPath = false;
bool bLimitProcessLifetime = false;
bool bSendUnattendedBugReports = false;
#Loc: <Workspace>/Engine/Source/Developer/Zen/Public/Experimental/ZenServerInterface.h:89
Scope (from outer to inner):
file
namespace UE::Zen
class class FZenLocalServiceRunContext
function FString GetDataPath
Source code excerpt:
FString GetCommandlineArguments() const { return CommandlineArguments; }
FString GetWorkingDirectory() const { return WorkingDirectory; }
FString GetDataPath() const { return DataPath; }
bool GetShowConsole() const { return bShowConsole; }
friend inline bool operator==(FZenLocalServiceRunContext LHS, FZenLocalServiceRunContext RHS)
{
return (LHS.Executable == RHS.Executable) && (LHS.CommandlineArguments == RHS.CommandlineArguments) && (LHS.WorkingDirectory == RHS.WorkingDirectory) && (LHS.DataPath == RHS.DataPath);
}
private:
FString Executable;
FString CommandlineArguments;
FString WorkingDirectory;
FString DataPath;
bool bShowConsole;
bool ReadFromJson(FJsonObject& JsonObject);
void WriteToJson(TJsonWriter<TCHAR, TPrettyJsonPrintPolicy<TCHAR>>& Writer) const;
bool ReadFromJsonFile(const TCHAR* Filename);
#Loc: <Workspace>/Engine/Source/Developer/Zen/Public/Experimental/ZenServerInterface.h:114
Scope (from outer to inner):
file
namespace UE::Zen
Source code excerpt:
};
UE_API bool IsLocalServiceRunning(const TCHAR* DataPath, uint16* OutPort = nullptr);
UE_API FProcHandle StartLocalService(const FZenLocalServiceRunContext& Context, const TCHAR* TransientArgs = nullptr);
UE_API bool StopLocalService(const TCHAR* DataPath, double MaximumWaitDurationSeconds = 25.0);
UE_API FString GetLocalServiceInstallPath();
UE_API FString GetLocalServiceInstallVersion(bool bDetailed = true);
UE_API FString GetLocalInstallUtilityPath();
struct FGCStatus
#Loc: <Workspace>/Engine/Source/Developer/Zen/Tests/ZenTest.cpp:29
Scope (from outer to inner):
file
namespace UE
Source code excerpt:
FServiceSettings ZenTestServiceSettings;
FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenTestAutoLaunchSettings.DataPath = DefaultDataPath;
ZenTestAutoLaunchSettings.ExtraArgs = DefaultArgs;
ZenTestAutoLaunchSettings.DesiredPort = DefaultTestPort;
{
FScopeZenService ScopeZenService(MoveTemp(ZenTestServiceSettings));
FZenServiceInstance& ZenInstance = ScopeZenService.GetInstance();
#Loc: <Workspace>/Engine/Source/Developer/Zen/Tests/ZenTest.cpp:54
Scope (from outer to inner):
file
namespace UE
Source code excerpt:
FServiceSettings ZenTestServiceSettings;
FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenTestAutoLaunchSettings.DataPath = DefaultDataPath;
ZenTestAutoLaunchSettings.ExtraArgs = DefaultArgs;
ZenTestAutoLaunchSettings.DesiredPort = DefaultTestPort;
{
FScopeZenService ScopeZenService(MoveTemp(ZenTestServiceSettings));
FZenServiceInstance& ZenInstance = ScopeZenService.GetInstance();
#Loc: <Workspace>/Engine/Source/Developer/Zen/Tests/ZenTest.cpp:79
Scope (from outer to inner):
file
namespace UE
Source code excerpt:
FServiceSettings ZenTestServiceSettings;
FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenTestAutoLaunchSettings.DataPath = DefaultDataPath;
ZenTestAutoLaunchSettings.ExtraArgs = *WriteToString<128>(DefaultArgs, TEXT(" --gc-interval-seconds "), (Iteration+1)*1000);
ZenTestAutoLaunchSettings.DesiredPort = DefaultTestPort;
{
FScopeZenService ScopeZenService(MoveTemp(ZenTestServiceSettings));
FZenServiceInstance& ZenInstance = ScopeZenService.GetInstance();
#Loc: <Workspace>/Engine/Source/Programs/ZenDashboard/Private/ZenDashboard.cpp:225
Scope (from outer to inner):
file
function void DeleteDataAndRestartZenServer
lambda-function
Source code excerpt:
UE::Tasks::Launch(TEXT("DeleteZenDataAndRestart"),
[this, DataPath = RunContext.GetDataPath()] ()
{
FPlatformProcess::Sleep(10.0f);
FPlatformFileManager::Get().GetPlatformFile().DeleteDirectoryRecursively(*DataPath);
StartZenServer();
bLatentExclusiveOperationActive = false;
},
UE::Tasks::ETaskPriority::BackgroundNormal
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/System/LyraAssetManager.h:53
Scope (from outer to inner):
file
class class ULyraAssetManager : public UAssetManager
function const GameDataClass& GetOrLoadTypedGameData
Source code excerpt:
protected:
template <typename GameDataClass>
const GameDataClass& GetOrLoadTypedGameData(const TSoftObjectPtr<GameDataClass>& DataPath)
{
if (TObjectPtr<UPrimaryDataAsset> const * pResult = GameDataMap.Find(GameDataClass::StaticClass()))
{
return *CastChecked<GameDataClass>(*pResult);
}
// Does a blocking load if needed
return *CastChecked<const GameDataClass>(LoadGameDataOfClass(GameDataClass::StaticClass(), DataPath, GameDataClass::StaticClass()->GetFName()));
}
static UObject* SynchronousLoadAsset(const FSoftObjectPath& AssetPath);
static bool ShouldLogAssetLoads();