Fixed Add-ons -> Remove Add-ons failing on windows.

This was caused by using remove() to delete directories which
removes only files on windows. Used rmdir() for that purpose instead.
This commit is contained in:
Sergey Popov 2009-01-19 21:51:29 +00:00
parent 0230609cd3
commit 9ac0bc4004

View File

@ -395,6 +395,14 @@ bool delete_directory(const std::string& path)
}
errno = 0;
#ifdef _WIN32
// remove() doesn't delete directories on windows.
int (*remove)(const char*);
if(is_directory(path))
remove = rmdir;
else
remove = ::remove;
#endif
if(remove(path.c_str()) != 0) {
LOG_FS << "remove(" << path << "): " << strerror(errno) << "\n";
ret = false;