first thanks for your code.
in work we use need delete directory file and create directory file recursively .
can you consider add them.
base create_directory in you work.
i and some function but not consider cross platform.
inline bool create_directory_deep(const path& p ) {
if (p.exists()){
return TRUE;
}
path pathParent = p.parent_path();
if (create_directory_deep(pathParent)){
if (p.empty()) return TRUE;
int ret = create_directory(p);
return ret;
//return create_directory(p);
}
else{
false;
}
return TRUE;
}
inline void getAllFiles(string path, vector& files)
{
long hFile = 0;
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\*").c_str(), &fileinfo)) != -1)
{
do
{
if ((fileinfo.attrib & _A_SUBDIR))
{
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
{
// no director return
//files.push_back(p.assign(path).append("/").append(fileinfo.name));
getAllFiles(p.assign(path).append("/").append(fileinfo.name), files);
}
}
else
{
files.push_back(p.assign(path).append("/").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}
first thanks for your code.
in work we use need delete directory file and create directory file recursively .
can you consider add them.
base create_directory in you work.
i and some function but not consider cross platform.
inline bool create_directory_deep(const path& p ) {
if (p.exists()){
return TRUE;
}
}
inline void getAllFiles(string path, vector& files)
{
long hFile = 0;
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\*").c_str(), &fileinfo)) != -1)
{
do
{
if ((fileinfo.attrib & _A_SUBDIR))
{
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
{
// no director return
//files.push_back(p.assign(path).append("/").append(fileinfo.name));
getAllFiles(p.assign(path).append("/").append(fileinfo.name), files);
}
}
else
{
files.push_back(p.assign(path).append("/").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}