implement Path::dirname()
This commit is contained in:
1 parent
eb12420155
commit
49ccad5ed4
2 files changed
+31
-2
No files matched your search
+20
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user