mirror of
https://github.com/lifegpc/c-utils.git
synced 2026-06-08 14:18:44 +08:00
fileop::join now support multiple input
This commit is contained in:
12
fileop.cpp
12
fileop.cpp
@@ -294,6 +294,18 @@ std::string fileop::join(std::string path, std::string path2) {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string fileop::join(std::initializer_list<std::string> paths) {
|
||||
std::string path;
|
||||
for (auto it = paths.begin(); it != paths.end(); it++) {
|
||||
if (it == paths.begin()) {
|
||||
path = *it;
|
||||
} else {
|
||||
path = join(path, *it);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
bool fileop::isdir(std::string path, bool& result) {
|
||||
if (!exists(path)) {
|
||||
result = false;
|
||||
|
||||
Reference in New Issue
Block a user