Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/HashCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace AppInstaller::CLI
[](Execution::Context& context)
{
auto inputFile = context.Args.GetArg(Execution::Args::Type::HashFile);
std::ifstream inStream{ inputFile, std::ifstream::binary };
std::ifstream inStream{ Utility::ConvertToUTF16(inputFile), std::ifstream::binary };

context.Reporter.Info() << "Sha256: "_liv << Utility::LocIndString{ Utility::SHA256::ConvertToString(Utility::SHA256::ComputeHash(inStream)) } << std::endl;

Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ValidateCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace AppInstaller::CLI
Workflow::VerifyFile(Execution::Args::Type::ValidateManifest) <<
[](Execution::Context& context)
{
auto inputFile = context.Args.GetArg(Execution::Args::Type::ValidateManifest);
auto inputFile = Utility::ConvertToUTF16(context.Args.GetArg(Execution::Args::Type::ValidateManifest));

try
{
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace AppInstaller::CLI::Workflow
const auto& installer = context.Get<Execution::Data::Installer>().value();

std::filesystem::path tempInstallerPath = Runtime::GetPathTo(Runtime::PathName::Temp);
tempInstallerPath /= manifest.Id + '.' + manifest.Version;
tempInstallerPath /= Utility::ConvertToUTF16(manifest.Id + '.' + manifest.Version);

AICLI_LOG(CLI, Info, << "Generated temp download path: " << tempInstallerPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ namespace AppInstaller::CLI::Workflow
{
AICLI_LOG(CLI, Info, << "Starting installer. Path: " << filePath);

SHELLEXECUTEINFOA execInfo = { 0 };
execInfo.cbSize = sizeof(SHELLEXECUTEINFO);
SHELLEXECUTEINFOW execInfo = { 0 };
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
std::string filePathUTF8Str = filePath.u8string();
execInfo.lpFile = filePathUTF8Str.c_str();
execInfo.lpParameters = args.c_str();
execInfo.lpFile = filePath.c_str();
std::wstring argsUtf16 = Utility::ConvertToUTF16(args);
execInfo.lpParameters = argsUtf16.c_str();
// Some installers force UI. Setting to SW_HIDE will hide installer UI and installation will hang forever.
// Verified setting to SW_SHOW does not hurt silent mode since no UI will be shown.
execInfo.nShow = SW_SHOW;
if (!ShellExecuteExA(&execInfo) || !execInfo.hProcess)
if (!ShellExecuteExW(&execInfo) || !execInfo.hProcess)
{
return GetLastError();
}
Expand Down Expand Up @@ -134,7 +134,7 @@ namespace AppInstaller::CLI::Workflow

if (Utility::FindAndReplace(installerArgs, std::string(ARG_TOKEN_LOGPATH), logPath))
{
context.Add<Execution::Data::LogPath>(logPath);
context.Add<Execution::Data::LogPath>(Utility::ConvertToUTF16(logPath));
}

// Populate <InstallPath> with value from command line.
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Workflows/WorkflowBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace AppInstaller::CLI::Workflow

void VerifyFile::operator()(Execution::Context& context) const
{
std::filesystem::path path = context.Args.GetArg(m_arg);
std::filesystem::path path = Utility::ConvertToUTF16(context.Args.GetArg(m_arg));

if (!std::filesystem::exists(path))
{
Expand All @@ -270,7 +270,7 @@ namespace AppInstaller::CLI::Workflow
VerifyFile(Execution::Args::Type::Manifest) <<
[](Execution::Context& context)
{
Manifest::Manifest manifest = Manifest::Manifest::CreateFromPath(context.Args.GetArg(Execution::Args::Type::Manifest));
Manifest::Manifest manifest = Manifest::Manifest::CreateFromPath(Utility::ConvertToUTF16(context.Args.GetArg(Execution::Args::Type::Manifest)));
Logging::Telemetry().LogManifestFields(manifest.Id, manifest.Name, manifest.Version, true);
context.Add<Execution::Data::Manifest>(std::move(manifest));
};
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLIE2ETests/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Constants
public const string AICLIPackageName = "WinGetDevCLI";
public const string AICLIAppId = "WinGetDev";

public const string TestPackage = "TestPackage.msix";
public const string TestPackage = "TëstPackage.msix";

public class ErrorCode
{
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/InstallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace AppInstallerCLIE2ETests
public class InstallCommand
{
// Todo: this should point to a loopback address. Disabling the install tests until we have loopback support done in our e2e tests.
// Todo: add unicode test cases after install tests are enabled.
private const string InstallTestSourceUrl = @"https://github.com/microsoft/appinstaller-cli/raw/master/src/AppInstallerCLIE2ETests/TestData";
private const string InstallTestSourceName = @"InstallTestSource";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Id: AppInstallerTest.TëstExeInstaller
Name: TestExeInstaller
Version: 1.0.0.0
Publisher: AppInstallerTest
License: Test
Installers:
- Arch: x86
Url: https://github.com/microsoft/appinstaller-cli/raw/master/src/AppInstallerCLIE2ETests/TestData/AppInstallerTestExeInstaller.exe
Sha256: 7c616e2fe3853b555ddea4cb50bd307da1dc47898a5fbc3a8646a470107802ab
InstallerType: exe
Switches:
Custom: /execustom
SilentWithProgress: /exeswp
Silent: /exesilent
Interactive: /exeinteractive
Language: /exeenus
Log: /exelog <LOGPATH>
InstallLocation: /InstallDir <INSTALLPATH>
ManifestVersion: 0.1.0
5 changes: 5 additions & 0 deletions src/AppInstallerCLIE2ETests/ValidateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public void ValidateCommands()
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);
Assert.True(result.StdOut.Contains("Manifest validation succeeded."));

// Validate a good yaml with extended character
result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\T�stExeInstaller.yaml"));
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);
Assert.True(result.StdOut.Contains("Manifest validation succeeded."));

// Validate invalid yaml
result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\TestInvalidManifest.yaml"));
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCommonCore/MsixInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ namespace AppInstaller::Msix
}
else
{
std::filesystem::path path(uriStr);
std::filesystem::path path(Utility::ConvertToUTF16(uriStr));
THROW_IF_FAILED(SHCreateStreamOnFileEx(path.c_str(),
STGM_READ | STGM_SHARE_DENY_WRITE | STGM_FAILIFTHERE, 0, FALSE, nullptr, &m_stream));
}
Expand Down
3 changes: 2 additions & 1 deletion src/AppInstallerRepositoryCore/Manifest/Manifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ namespace AppInstaller::Manifest

try
{
YAML::Node rootNode = YAML::LoadFile(inputFile.u8string());
std::ifstream inputStream(inputFile);
YAML::Node rootNode = YAML::Load(inputStream);
errors = manifest.PopulateManifestFields(rootNode, fullValidation);
}
catch (const ManifestException&)
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerRepositoryCore/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <algorithm>
#include <chrono>
#include <filesystem>
#include <fstream>
#include <initializer_list>
#include <iomanip>
#include <optional>
Expand Down