32 #ifndef DRAIN_FILES_H_
33 #define DRAIN_FILES_H_
45 #include <drain/RegExp.h>
62 typedef Path<std::string,
'/',
true,
false,
true>
path_t;
66 template<
typename ...TT>
82 this->basename.clear();
83 this->extension.clear();
88 template<
typename ...TT>
90 void set(
const TT &... args){
95 template<
typename T,
typename ...TT>
96 void append(
const T & arg,
const TT &... args){
109 void append(
const std::string & s);
123 bool operator==(
const FilePath & p)
const {
125 if (p.basename != basename)
128 if (p.extension != extension)
139 std::string basename;
140 std::string extension;
150 std::ostream &
toStream(std::ostream & ostr)
const {
154 if (!dir.back().empty())
155 ostr << dir.separator.character;
160 if (!extension.empty())
161 ostr <<
'.' << extension;
168 std::string str()
const {
169 std::stringstream sstr;
176 this->dir << path.dir;
177 if (!this->basename.empty())
178 std::cerr << __FILE__ <<
" warning: dropped:" << this->basename <<
'\n';
179 this->basename = path.basename;
180 this->extension = path.extension;
186 int mkdir(
const std::string & dirpath,
int flags = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH){
187 return mkdir(FilePath::path_t(dirpath), flags);
192 int mkdir(
const FilePath::path_t & dirpath,
int flags = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
198 std::ostream & operator<<(std::ostream & ostr,
const FilePath & p) {
199 return p.toStream(ostr);
Extracts and stores directory path, base filename and extension.
Definition: FilePath.h:58
FilePath(const TT &... args)
Constructor.
Definition: FilePath.h:68
virtual std::ostream & toStream(std::ostream &ostr) const
Directory path separator.
Definition: FilePath.h:150
void append(const T2 &arg, const TT &... args)
Append path with element(s), path(s) or string(s).
Definition: Path.h:196
Definition: DataSelector.cpp:1277