aboutsummaryrefslogtreecommitdiff
path: root/src/zenmaster/hostinterface.cpp
blob: 39e7a51cc7c7d6f90039399d24dd0da329ec0a13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright Epic Games, Inc. All Rights Reserved.

#include "hostinterface.h"

#include <zencore/filesystem.h>

namespace zen {

ZenServerHost::ZenServerHost()
{
}

ZenServerHost::~ZenServerHost()
{
}

// TODO: Constrain access via AppContainer mechanisms
//
// AppContainer is the mechanism used by UWP apps. A process
// in AppContainer can only access explicitly granted folders via capabilities.
//
// You can create a classic Win32 process in an AppContainer using CreateProcess
// with an AppContainer token.
//
// Grant access to specific folders using CreateAppContainerProfile() and
// AppContainerNamedObjectPath.
//

void
ZenServerHost::SpawnOne(std::string_view Id)
{
	std::unique_ptr<LiveProcess> Proc = std::make_unique<LiveProcess>();

	std::filesystem::path ProgramBaseDir = GetRunningExecutablePath().parent_path();

	Proc->Env.Initialize(ProgramBaseDir);
	Proc->Server = std::make_unique<ZenServerInstance>(Proc->Env);
	Proc->Server->SpawnServerAndWait();

	m_LiveProcessesByProjectId.insert({std::string{Id}, std::move(Proc)});
}

}  // namespace zen