本文整理汇总了C++中std::filesystem::path::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ path::empty方法的具体用法?C++ path::empty怎么用?C++ path::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::filesystem::path
的用法示例。
在下文中一共展示了path::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
HOSTFXR_UTILITY::GetHostFxrParameters(
const fs::path &processPath,
const fs::path &applicationPhysicalPath,
const std::wstring &applicationArguments,
fs::path &hostFxrDllPath,
fs::path &dotnetExePath,
std::vector<std::wstring> &arguments
)
{
LOG_INFOF(L"Resolving hostfxr parameters for application: '%ls' arguments: '%ls' path: '%ls'",
processPath.c_str(),
applicationArguments.c_str(),
applicationPhysicalPath.c_str());
arguments = std::vector<std::wstring>();
fs::path expandedProcessPath = Environment::ExpandEnvironmentVariables(processPath);
const auto expandedApplicationArguments = Environment::ExpandEnvironmentVariables(applicationArguments);
LOG_INFOF(L"Known dotnet.exe location: '%ls'", dotnetExePath.c_str());
if (!expandedProcessPath.has_extension())
{
// The only executable extension inprocess supports
expandedProcessPath.replace_extension(".exe");
}
else if (!ends_with(expandedProcessPath, L".exe", true))
{
throw InvalidOperationException(format(L"Process path '%s' doesn't have '.exe' extension.", expandedProcessPath.c_str()));
}
// Check if the absolute path is to dotnet or not.
if (IsDotnetExecutable(expandedProcessPath))
{
LOG_INFOF(L"Process path '%ls' is dotnet, treating application as portable", expandedProcessPath.c_str());
if (applicationArguments.empty())
{
throw InvalidOperationException(L"Application arguments are empty.");
}
if (dotnetExePath.empty())
{
dotnetExePath = GetAbsolutePathToDotnet(applicationPhysicalPath, expandedProcessPath);
}
hostFxrDllPath = GetAbsolutePathToHostFxr(dotnetExePath);
arguments.push_back(dotnetExePath);
AppendArguments(
expandedApplicationArguments,
applicationPhysicalPath,
arguments,
true);
}
else
{
LOG_INFOF(L"Process path '%ls' is not dotnet, treating application as standalone or portable with bootstrapper", expandedProcessPath.c_str());
auto executablePath = expandedProcessPath;
if (executablePath.is_relative())
{
executablePath = applicationPhysicalPath / expandedProcessPath;
}
//
// The processPath is a path to the application executable
// like: C:\test\MyApp.Exe or MyApp.Exe
// Check if the file exists, and if it does, get the parameters for a standalone application
//
if (is_regular_file(executablePath))
{
auto applicationDllPath = executablePath;
applicationDllPath.replace_extension(".dll");
LOG_INFOF(L"Checking application.dll at '%ls'", applicationDllPath.c_str());
if (!is_regular_file(applicationDllPath))
{
throw InvalidOperationException(format(L"Application .dll was not found at %s", applicationDllPath.c_str()));
}
hostFxrDllPath = executablePath.parent_path() / "hostfxr.dll";
LOG_INFOF(L"Checking hostfxr.dll at '%ls'", hostFxrDllPath.c_str());
if (is_regular_file(hostFxrDllPath))
{
LOG_INFOF(L"hostfxr.dll found app local at '%ls', treating application as standalone", hostFxrDllPath.c_str());
// For standalone apps we need .exe to be argv[0], dll would be discovered next to it
arguments.push_back(executablePath);
}
else
{
LOG_INFOF(L"hostfxr.dll found app local at '%ls', treating application as portable with launcher", hostFxrDllPath.c_str());
// passing "dotnet" here because we don't know where dotnet.exe should come from
// so trying all fallbacks is appropriate
if (dotnetExePath.empty())
{
dotnetExePath = GetAbsolutePathToDotnet(applicationPhysicalPath, L"dotnet");
}
//.........这里部分代码省略.........