Files
UnrealEngineUWP/Engine/Source/Editor/ConfigEditor/Private/ConfigPropertyHelper.cpp
bryan sefcik 8cc129f2b6 IWYU Pass 1 - Engine/Source/Editor/...
#jira
#preflight 6306736ac85b7fef22be7751

[CL 21558583 by bryan sefcik in ue5-main branch]
2022-08-24 22:45:13 -04:00

51 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ConfigPropertyHelper.h"
#include "HAL/FileManager.h"
#include "ISourceControlModule.h"
#include "ISourceControlState.h"
#include "Misc/Paths.h"
#include "Templates/SharedPointer.h"
#include "UObject/UnrealType.h"
class ISourceControlProvider;
void UPropertyConfigFileDisplayRow::InitWithConfigAndProperty(const FString& InConfigFileName, FProperty* InEditProperty)
{
ConfigFileName = FPaths::ConvertRelativePathToFull(InConfigFileName);
ExternalProperty = InEditProperty;
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
// We will add source control soon...
FSourceControlStatePtr SourceControlState = nullptr; // SourceControlProvider.GetState(ConfigFileName, EStateCacheUsage::Use);
// Only include config files that are currently checked out or packages not under source control
{
if (FPaths::FileExists(ConfigFileName))
{
if (SourceControlState.IsValid())
{
bIsFileWritable = SourceControlState->IsCheckedOut() || SourceControlState->IsAdded();
}
else
{
bIsFileWritable = !IFileManager::Get().IsReadOnly(*ConfigFileName);
}
}
else
{
if (SourceControlState.IsValid())
{
bIsFileWritable = (SourceControlState->IsSourceControlled() && SourceControlState->CanAdd());
}
else
{
bIsFileWritable = false;
}
}
}
}