mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Start using std::filesystem::path for fusepath (#1522)
This commit is contained in:
parent
f64ff9ca1e
commit
8c649d33ee
139 changed files with 1711 additions and 1663 deletions
|
|
@ -15,45 +15,3 @@
|
|||
*/
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
string
|
||||
fs::path::dirname(const char *path_)
|
||||
{
|
||||
string path(path_);
|
||||
|
||||
return fs::path::dirname(path);
|
||||
}
|
||||
|
||||
string
|
||||
fs::path::dirname(const string &path_)
|
||||
{
|
||||
std::size_t i;
|
||||
|
||||
i = path_.size() - 1;
|
||||
while((i > 0) && (path_[i] == '/'))
|
||||
i--;
|
||||
|
||||
while((i > 0) && (path_[i] != '/'))
|
||||
i--;
|
||||
|
||||
while((i > 0) && (path_[i] == '/'))
|
||||
i--;
|
||||
|
||||
return path_.substr(0,i+1);
|
||||
}
|
||||
|
||||
string
|
||||
fs::path::basename(const string &path_)
|
||||
{
|
||||
return path_.substr(path_.find_last_of('/')+1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue