Files
UnrealEngineUWP/Engine/Source/Editor/ConfigEditor/Private/ConfigPropertyHelper.cpp
ryan durand 627baf970a Updating copyright for Engine Editor.
#rnx
#rb none


#ROBOMERGE-SOURCE: CL 10869241 via CL 10869527 via CL 10869904
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870586 by ryan durand in Main branch]
2019-12-26 15:33:43 -05:00

46 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ConfigPropertyHelper.h"
#include "HAL/FileManager.h"
#include "Misc/Paths.h"
#include "ISourceControlState.h"
#include "ISourceControlModule.h"
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;
}
}
}
}