Example #1
0
pal::string_t get_directory(const pal::string_t& path)
{
    // Find the last dir separator
    auto path_sep = path.find_last_of(DIR_SEPARATOR);
    if (path_sep == pal::string_t::npos)
    {
        return pal::string_t(path);
    }

    return path.substr(0, path_sep);
}
Example #2
0
pal::string_t get_filename_without_ext(const pal::string_t& path)
{
    if (path.empty())
    {
        return path;
    }

    size_t name_pos = path.find_last_of(_X("/\\"));
    size_t dot_pos = path.rfind(_X('.'));
    size_t start_pos = (name_pos == pal::string_t::npos) ? 0 : (name_pos + 1);
    size_t count = (dot_pos == pal::string_t::npos || dot_pos < start_pos) ? pal::string_t::npos : (dot_pos - start_pos);
    return path.substr(start_pos, count);
}
Example #3
0
pal::string_t get_filename(const pal::string_t& path)
{
    if (path.empty())
    {
        return path;
    }

    auto name_pos = path.find_last_of(DIR_SEPARATOR);
    if (name_pos == pal::string_t::npos)
    {
        return path;
    }

    return path.substr(name_pos + 1);
}
Example #4
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"));
}