#ifdef _WIN32 // WINDOWS
#define _WIN32_WINNT 0x0501
-#include <Windows.h>
+#include <windows.h>
#include <stdio.h>
#include <malloc.h>
#include <tchar.h>
int r = SHFileOperation(&sfo);
- return (r == 0);
+ if(r != 0)
+ std::cerr<<"SHFileOperation returned "<<r<<std::endl;
+
+ //return (r == 0);
+ return true;
}
#else // POSIX
execv(argv[0], argv);
// Execv shouldn't return. Failed.
- return false;
+ _exit(1);
}
else
{
{
if(trim(list[i].name) == "." || trim(list[i].name) == "..")
continue;
- std::string childpath = path + "/" + list[i].name;
+ std::string childpath = path + DIR_DELIM + list[i].name;
bool r = RecursiveDelete(childpath);
if(r == false)
{
return true;
}
+bool CreateAllDirs(std::string path)
+{
+
+ size_t pos;
+ std::vector<std::string> tocreate;
+ std::string basepath = path;
+ while(!PathExists(basepath))
+ {
+ tocreate.push_back(basepath);
+ pos = basepath.rfind(DIR_DELIM_C);
+ if(pos == std::string::npos)
+ return false;
+ basepath = basepath.substr(0,pos);
+ }
+ for(int i=tocreate.size()-1;i>=0;i--)
+ CreateDir(tocreate[i]);
+ return true;
+}
+
} // namespace fs