Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can add delete directory create file function #22

Open
yueswing07 opened this issue Dec 22, 2017 · 0 comments
Open

can add delete directory create file function #22

yueswing07 opened this issue Dec 22, 2017 · 0 comments

Comments

@yueswing07
Copy link

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);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant