forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResumeFlow.cpp
More file actions
37 lines (32 loc) · 1.24 KB
/
Copy pathResumeFlow.cpp
File metadata and controls
37 lines (32 loc) · 1.24 KB
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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"
#include "ResumeFlow.h"
#include "winget/Reboot.h"
#include <AppInstallerRuntime.h>
namespace AppInstaller::CLI::Workflow
{
void Checkpoint::operator()(Execution::Context& context) const
{
if (!Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Resume))
{
return;
}
context.Checkpoint(m_checkpointName, m_contextData);
}
void RegisterStartupAfterReboot::operator()(Execution::Context& context) const
{
if (!Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Resume))
{
return;
}
if (WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::RegisterResume))
{
auto executablePath = AppInstaller::Runtime::GetPathTo(AppInstaller::Runtime::PathName::CLIExecutable);
// RunOnce registry value must start with the full path of the executable.
const auto& resumeId = context.GetResumeId();
std::string commandLine = executablePath.u8string() + " resume -g " + resumeId;
Reboot::WriteToRunOnceRegistry(resumeId, commandLine);
}
}
}