forked from organicmaps/organicmaps
[platform] Fixed MkDirRecursively
This commit is contained in:
parent
1513218db9
commit
70661f172c
2 changed files with 6 additions and 2 deletions
|
@ -40,6 +40,9 @@ inline std::string JoinPath(std::string const & file) { return file; }
|
|||
template <typename... Args>
|
||||
std::string JoinPath(std::string const & folder, Args &&... args)
|
||||
{
|
||||
if (folder.empty())
|
||||
return JoinPath(std::forward<Args>(args)...);
|
||||
|
||||
return AddSlashIfNeeded(folder) + JoinPath(std::forward<Args>(args)...);
|
||||
}
|
||||
} // namespace base
|
||||
|
|
|
@ -294,8 +294,9 @@ bool Platform::MkDirChecked(string const & dirName)
|
|||
// static
|
||||
bool Platform::MkDirRecursively(string const & dirName)
|
||||
{
|
||||
auto const tokens = strings::Tokenize(dirName, base::GetNativeSeparator().c_str());
|
||||
string path = base::GetNativeSeparator();
|
||||
auto const sep = base::GetNativeSeparator();
|
||||
string path = strings::StartsWith(dirName, sep) ? sep : "";
|
||||
auto const tokens = strings::Tokenize(dirName, sep.c_str());
|
||||
for (auto const & t : tokens)
|
||||
{
|
||||
path = base::JoinPath(path, t);
|
||||
|
|
Loading…
Add table
Reference in a new issue