implement Path::dirname()

This commit is contained in:
josh committed 2014-06-19 00:01:10 -04:00
1 parent eb12420155
commit 49ccad5ed4
2 files changed
+31 -2

No files matched your search

+20 -2
View File
@@ -16,8 +16,26 @@ namespace jes
Path Path::dirname()
{
// TODO
return "";
size_t i = m_path.size() - 1;
while (m_path[i] == '/')
{
if (i == 0)
return "/";
i--;
}
while (m_path[i] != '/')
{
if (i == 0)
return ".";
i--;
}
while (m_path[i] == '/')
{
if (i == 0)
return "/";
i--;
}
return std::string(m_path, 0, i + 1);
}
Path Path::join(const Path & other)