Exemplo n.º 1
0
void tpafile::write_tpa_list(pal::string_t& output)
{
	std::set<pal::string_t> items;
	for (auto entry : m_entries)
	{
		if (pal::strcmp(entry.asset_type.c_str(), _X("runtime")) == 0 && items.find(entry.asset_name) == items.end())
		{
			// Resolve the full path
			for (auto search_path : m_package_search_paths)
			{
				pal::string_t candidate;
				candidate.reserve(search_path.length() +
					entry.library_name.length() +
					entry.library_version.length() +
					entry.relative_path.length() + 3);
				candidate.append(search_path);

				append_path(candidate, entry.library_name.c_str());
				append_path(candidate, entry.library_version.c_str());
				append_path(candidate, entry.relative_path.c_str());
				if (pal::file_exists(candidate))
				{
					trace::verbose(_X("adding tpa entry: %s"), candidate.c_str());

					output.append(candidate);
					output.push_back(PATH_SEPARATOR);
					items.insert(entry.asset_name);
					break;
				}
			}
		}
	}
}
Exemplo n.º 2
0
void tpafile::write_native_paths(pal::string_t& output)
{
	std::set<pal::string_t> items;
	for (auto search_path : m_native_search_paths)
	{
		if (items.find(search_path) == items.end())
		{
			trace::verbose(_X("adding native search path: %s"), search_path.c_str());
			output.append(search_path);
			output.push_back(PATH_SEPARATOR);
			items.insert(search_path);
		}
	}

	for (auto entry : m_entries)
	{
		auto dir = entry.relative_path.substr(0, entry.relative_path.find_last_of(DIR_SEPARATOR));
		if (pal::strcmp(entry.asset_type.c_str(), _X("native")) == 0 && items.find(dir) == items.end())
		{
			// Resolve the full path
			for (auto search_path : m_package_search_paths)
			{
				pal::string_t candidate;
				candidate.reserve(search_path.length() +
					entry.library_name.length() +
					entry.library_version.length() +
					dir.length() + 3);
				candidate.append(search_path);

				append_path(candidate, entry.library_name.c_str());
				append_path(candidate, entry.library_version.c_str());
				append_path(candidate, get_directory(entry.relative_path).c_str());

				if (pal::file_exists(candidate))
				{
					trace::verbose(_X("adding native search path: %s"), candidate.c_str());
					output.append(candidate);
					output.push_back(PATH_SEPARATOR);
					items.insert(dir);
					break;
				}
			}
		}
	}
}
Exemplo n.º 3
0
void get_tpafile_path(const pal::string_t& app_base, const pal::string_t& app_name, pal::string_t& tpapath)
{
    tpapath.reserve(app_base.length() + app_name.length() + 5);

    tpapath.append(app_base);
    tpapath.push_back(DIR_SEPARATOR);

    // Remove the extension from the app_name
    auto ext_location = app_name.find_last_of('.');
    if (ext_location != std::string::npos)
    {
        tpapath.append(app_name.substr(0, ext_location));
    }
    else
    {
        tpapath.append(app_name);
    }
    tpapath.append(_X(".deps"));
}
Exemplo n.º 4
0
void append_path(pal::string_t& path1, const pal::char_t* path2)
{
    if (pal::is_path_rooted(path2))
    {
        path1.assign(path2);
    }
    else
    {
        if (path1.back() != DIR_SEPARATOR)
        {
            path1.push_back(DIR_SEPARATOR);
        }
        path1.append(path2);
    }
}