2014-03-14 14:13:41 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "NetworkFileSystemPrivatePCH.h"
|
2014-04-23 18:35:08 -04:00
|
|
|
#include "TargetDeviceId.h"
|
|
|
|
|
#include "ITargetDevice.h"
|
|
|
|
|
#include "ITargetPlatformManagerModule.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "ModuleManager.h"
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
DEFINE_LOG_CATEGORY(LogFileServer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements the NetworkFileSystem module.
|
|
|
|
|
*/
|
|
|
|
|
class FNetworkFileSystemModule
|
|
|
|
|
: public INetworkFileSystemModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// INetworkFileSystemModule interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual INetworkFileServer* CreateNetworkFileServer( int32 Port, const FFileRequestDelegate* InFileRequestDelegate, const FRecompileShadersDelegate* InRecompileShadersDelegate ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
if (Port < 0)
|
|
|
|
|
{
|
|
|
|
|
Port = DEFAULT_FILE_SERVING_PORT;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 18:33:50 -04:00
|
|
|
TArray<ITargetPlatform*> ActiveTargetPlatforms;
|
|
|
|
|
|
|
|
|
|
// only bother getting the target platforms if there was "-targetplatform" on the commandline, otherwise UnrealFileServer will
|
|
|
|
|
// log out some scary sounding, but innocuous logs
|
|
|
|
|
FString Platforms;
|
|
|
|
|
if (FParse::Value(FCommandLine::Get(), TEXT("TARGETPLATFORM="), Platforms))
|
|
|
|
|
{
|
|
|
|
|
ITargetPlatformManagerModule& TPM = GetTargetPlatformManagerRef();
|
|
|
|
|
ActiveTargetPlatforms = TPM.GetActiveTargetPlatforms();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-12 17:02:52 -04:00
|
|
|
#if !USE_HTTP_FOR_NFS
|
2014-04-23 18:33:50 -04:00
|
|
|
return new FNetworkFileServer(Port, InFileRequestDelegate, InRecompileShadersDelegate, ActiveTargetPlatforms);
|
2014-06-12 17:02:52 -04:00
|
|
|
#else
|
|
|
|
|
return new FNetworkFileServerHttp(Port, InFileRequestDelegate, InRecompileShadersDelegate, ActiveTargetPlatforms);
|
|
|
|
|
#endif
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
IMPLEMENT_MODULE(FNetworkFileSystemModule, NetworkFileSystem);
|