Skip to content

Commit

Permalink
Validate path
Browse files Browse the repository at this point in the history
  • Loading branch information
florelis committed Jul 28, 2022
1 parent bea291a commit 89a560d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/AppInstallerCLICore/ExecutionReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,25 @@ namespace AppInstaller::CLI::Execution
std::filesystem::path Reporter::PromptForPath(Resource::LocString message, Level level)
{
auto out = GetOutputStream(level);
out << message << ' ';

// Try prompting until we get a valid answer
for (;;)
{
out << message << ' ';

// Read the response
std::string response;
if (!std::getline(m_in, response))
{
THROW_HR(APPINSTALLER_CLI_ERROR_PROMPT_INPUT_ERROR);
}

// TODO: Check
return response;
// Validate the path
std::filesystem::path path{ response };
if (path.is_absolute())
{
return path;
}
}

}
Expand Down

0 comments on commit 89a560d

Please sign in to comment.