mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 11:37:12 +01:00
elevation_prompt_user_choice -> ElevationPromptChoice
This commit is contained in:
parent
3677b2c3c8
commit
e1af07d45a
@ -100,13 +100,13 @@ namespace vcpkg::Commands::Integrate
|
|||||||
return nuspec_file_content;
|
return nuspec_file_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class elevation_prompt_user_choice
|
enum class ElevationPromptChoice
|
||||||
{
|
{
|
||||||
yes,
|
YES,
|
||||||
no
|
NO
|
||||||
};
|
};
|
||||||
|
|
||||||
static elevation_prompt_user_choice elevated_cmd_execute(const std::string& param)
|
static ElevationPromptChoice elevated_cmd_execute(const std::string& param)
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFO shExInfo = { 0 };
|
SHELLEXECUTEINFO shExInfo = { 0 };
|
||||||
shExInfo.cbSize = sizeof(shExInfo);
|
shExInfo.cbSize = sizeof(shExInfo);
|
||||||
@ -122,15 +122,15 @@ namespace vcpkg::Commands::Integrate
|
|||||||
|
|
||||||
if (!ShellExecuteExA(&shExInfo))
|
if (!ShellExecuteExA(&shExInfo))
|
||||||
{
|
{
|
||||||
return elevation_prompt_user_choice::no;
|
return ElevationPromptChoice::NO;
|
||||||
}
|
}
|
||||||
if (shExInfo.hProcess == nullptr)
|
if (shExInfo.hProcess == nullptr)
|
||||||
{
|
{
|
||||||
return elevation_prompt_user_choice::no;
|
return ElevationPromptChoice::NO;
|
||||||
}
|
}
|
||||||
WaitForSingleObject(shExInfo.hProcess, INFINITE);
|
WaitForSingleObject(shExInfo.hProcess, INFINITE);
|
||||||
CloseHandle(shExInfo.hProcess);
|
CloseHandle(shExInfo.hProcess);
|
||||||
return elevation_prompt_user_choice::yes;
|
return ElevationPromptChoice::YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fs::path get_appdata_targets_path()
|
static fs::path get_appdata_targets_path()
|
||||||
@ -147,12 +147,12 @@ namespace vcpkg::Commands::Integrate
|
|||||||
if (fs::exists(old_system_wide_targets_file))
|
if (fs::exists(old_system_wide_targets_file))
|
||||||
{
|
{
|
||||||
const std::string param = Strings::format(R"(/c DEL "%s" /Q > nul)", old_system_wide_targets_file.string());
|
const std::string param = Strings::format(R"(/c DEL "%s" /Q > nul)", old_system_wide_targets_file.string());
|
||||||
elevation_prompt_user_choice user_choice = elevated_cmd_execute(param);
|
ElevationPromptChoice user_choice = elevated_cmd_execute(param);
|
||||||
switch (user_choice)
|
switch (user_choice)
|
||||||
{
|
{
|
||||||
case elevation_prompt_user_choice::yes:
|
case ElevationPromptChoice::YES:
|
||||||
break;
|
break;
|
||||||
case elevation_prompt_user_choice::no:
|
case ElevationPromptChoice::NO:
|
||||||
System::println(System::Color::warning, "Warning: Previous integration file was not removed");
|
System::println(System::Color::warning, "Warning: Previous integration file was not removed");
|
||||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||||
default:
|
default:
|
||||||
@ -186,12 +186,12 @@ namespace vcpkg::Commands::Integrate
|
|||||||
std::ofstream(sys_src_path) << create_system_targets_shortcut();
|
std::ofstream(sys_src_path) << create_system_targets_shortcut();
|
||||||
|
|
||||||
const std::string param = Strings::format(R"(/c mkdir "%s" & copy "%s" "%s" /Y > nul)", system_wide_targets_file.parent_path().string(), sys_src_path.string(), system_wide_targets_file.string());
|
const std::string param = Strings::format(R"(/c mkdir "%s" & copy "%s" "%s" /Y > nul)", system_wide_targets_file.parent_path().string(), sys_src_path.string(), system_wide_targets_file.string());
|
||||||
elevation_prompt_user_choice user_choice = elevated_cmd_execute(param);
|
ElevationPromptChoice user_choice = elevated_cmd_execute(param);
|
||||||
switch (user_choice)
|
switch (user_choice)
|
||||||
{
|
{
|
||||||
case elevation_prompt_user_choice::yes:
|
case ElevationPromptChoice::YES:
|
||||||
break;
|
break;
|
||||||
case elevation_prompt_user_choice::no:
|
case ElevationPromptChoice::NO:
|
||||||
System::println(System::Color::warning, "Warning: integration was not applied");
|
System::println(System::Color::warning, "Warning: integration was not applied");
|
||||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user