35 lines
844 B
C++
35 lines
844 B
C++
#ifndef PATH_H
|
|
#define PATH_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
class Path
|
|
{
|
|
public:
|
|
static std::string dirname(const std::string & s);
|
|
|
|
template <typename... Parts>
|
|
static std::string join(Parts... parts)
|
|
{
|
|
return _join(parts...);
|
|
}
|
|
|
|
static bool is_file(const std::string & s);
|
|
static bool is_dir(const std::string & s);
|
|
static std::shared_ptr<std::vector<std::shared_ptr<std::string>>> listdir(const std::string & path);
|
|
static std::string clean(const std::string & s);
|
|
|
|
protected:
|
|
static std::string _join(const std::string & first, const std::string & second);
|
|
|
|
template <typename... Parts>
|
|
static std::string _join(const std::string & first, const std::string & second, Parts... more)
|
|
{
|
|
return _join(_join(first, second), more...);
|
|
}
|
|
};
|
|
|
|
#endif
|