mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
commit
83208d8b89
2 changed files with 16 additions and 10 deletions
|
@ -137,17 +137,14 @@ std::vector<std::string> fmt::split(const std::string& source, std::initializer_
|
||||||
|
|
||||||
std::string fmt::merge(std::vector<std::string> source, const std::string& separator)
|
std::string fmt::merge(std::vector<std::string> source, const std::string& separator)
|
||||||
{
|
{
|
||||||
if (!source.size())
|
|
||||||
return "";
|
|
||||||
|
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
||||||
for (int i = 0; i < source.size() - 1; ++i)
|
for (auto &s : source)
|
||||||
{
|
{
|
||||||
result += source[i] + separator;
|
result += s + separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result + source[source.size() - 1];
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fmt::merge(std::initializer_list<std::vector<std::string>> sources, const std::string& separator)
|
std::string fmt::merge(std::initializer_list<std::vector<std::string>> sources, const std::string& separator)
|
||||||
|
|
|
@ -32,12 +32,21 @@ std::string simplify_path(const std::string& path, bool is_dir)
|
||||||
{
|
{
|
||||||
std::vector<std::string> path_blocks = simplify_path_blocks(path);
|
std::vector<std::string> path_blocks = simplify_path_blocks(path);
|
||||||
|
|
||||||
|
std::string result;
|
||||||
|
|
||||||
if (path_blocks.empty())
|
if (path_blocks.empty())
|
||||||
return "";
|
return result;
|
||||||
|
|
||||||
std::string result = fmt::merge(path_blocks, "/");
|
if (is_dir)
|
||||||
|
{
|
||||||
|
result = fmt::merge(path_blocks, "/");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = fmt::merge(std::vector<std::string>(path_blocks.begin(), path_blocks.end() - 1), "/") + path_blocks[path_blocks.size() - 1];
|
||||||
|
}
|
||||||
|
|
||||||
return is_dir ? result + "/" : result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
VFS::~VFS()
|
VFS::~VFS()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue