You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AddContentDialogPCH.h"
|
|
|
|
#include "FeaturePackContentSourceProvider.h"
|
|
#include "FeaturePackContentSource.h"
|
|
|
|
class FFillArrayDirectoryVisitor : public IPlatformFile::FDirectoryVisitor
|
|
{
|
|
public:
|
|
virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) override
|
|
{
|
|
if (bIsDirectory)
|
|
{
|
|
Directories.Add(FilenameOrDirectory);
|
|
}
|
|
else
|
|
{
|
|
Files.Add(FilenameOrDirectory);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
TArray<FString> Directories;
|
|
TArray<FString> Files;
|
|
};
|
|
|
|
FFeaturePackContentSourceProvider::FFeaturePackContentSourceProvider()
|
|
{
|
|
//TODO: Add a directory watcher?
|
|
FString FeaturePackPath = FPaths::Combine(*FPaths::RootDir(), TEXT("FeaturePacks"), TEXT("Packed"));
|
|
IPlatformFile &PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
|
|
FFillArrayDirectoryVisitor DirectoryVisitor;
|
|
PlatformFile.IterateDirectory(*FeaturePackPath, DirectoryVisitor);
|
|
for (auto FeaturePackFile : DirectoryVisitor.Files)
|
|
{
|
|
ContentSources.Add(MakeShareable(new FFeaturePackContentSource(FeaturePackFile)));
|
|
}
|
|
}
|
|
|
|
const TArray<TSharedRef<IContentSource>> FFeaturePackContentSourceProvider::GetContentSources()
|
|
{
|
|
return ContentSources;
|
|
}
|
|
|
|
void FFeaturePackContentSourceProvider::SetContentSourcesChanged(FOnContentSourcesChanged OnContentSourcesChangedIn)
|
|
{
|
|
OnContentSourcesChanged = OnContentSourcesChangedIn;
|
|
}
|
|
|
|
FFeaturePackContentSourceProvider::~FFeaturePackContentSourceProvider()
|
|
{
|
|
} |