mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-20 15:06:33 -05:00
misc cleanups
This commit is contained in:
parent
47bf58eae9
commit
9e0ab1f518
40 changed files with 559 additions and 432 deletions
|
|
@ -29,24 +29,37 @@ namespace fs
|
|||
{
|
||||
namespace path
|
||||
{
|
||||
void
|
||||
dirname(string &path)
|
||||
string
|
||||
dirname(const char *path_)
|
||||
{
|
||||
string path(path_);
|
||||
|
||||
return fs::path::dirname(&path);
|
||||
}
|
||||
|
||||
string
|
||||
dirname(const string *path_)
|
||||
{
|
||||
string rv;
|
||||
string::reverse_iterator i;
|
||||
string::reverse_iterator bi;
|
||||
string::reverse_iterator ei;
|
||||
|
||||
bi = path.rend();
|
||||
i = path.rbegin();
|
||||
while(*i == '/' && i != bi)
|
||||
rv = *path_;
|
||||
|
||||
i = rv.rbegin();
|
||||
ei = rv.rend();
|
||||
while(*i == '/' && i != ei)
|
||||
i++;
|
||||
|
||||
while(*i != '/' && i != bi)
|
||||
while(*i != '/' && i != ei)
|
||||
i++;
|
||||
|
||||
while(*i == '/' && i != bi)
|
||||
while(*i == '/' && i != ei)
|
||||
i++;
|
||||
|
||||
path.erase(i.base(),path.end());
|
||||
rv.erase(i.base(),rv.end());
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue