mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-11 05:11:11 +00:00
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:
parent
0230609cd3
commit
9ac0bc4004
@ -395,6 +395,14 @@ bool delete_directory(const std::string& path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
errno = 0;
|
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) {
|
if(remove(path.c_str()) != 0) {
|
||||||
LOG_FS << "remove(" << path << "): " << strerror(errno) << "\n";
|
LOG_FS << "remove(" << path << "): " << strerror(errno) << "\n";
|
||||||
ret = false;
|
ret = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user