diff options
Diffstat (limited to 'src/common/file_util.cpp')
| -rw-r--r-- | src/common/file_util.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 84fe95c8c..bc83ab737 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -457,14 +457,12 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo | |||
| 457 | do { | 457 | do { |
| 458 | const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName)); | 458 | const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName)); |
| 459 | #else | 459 | #else |
| 460 | struct dirent dirent, *result = nullptr; | ||
| 461 | |||
| 462 | DIR *dirp = opendir(directory.c_str()); | 460 | DIR *dirp = opendir(directory.c_str()); |
| 463 | if (!dirp) | 461 | if (!dirp) |
| 464 | return false; | 462 | return false; |
| 465 | 463 | ||
| 466 | // non windows loop | 464 | // non windows loop |
| 467 | while (!readdir_r(dirp, &dirent, &result) && result) { | 465 | while (struct dirent* result = readdir(dirp)) { |
| 468 | const std::string virtual_name(result->d_name); | 466 | const std::string virtual_name(result->d_name); |
| 469 | #endif | 467 | #endif |
| 470 | 468 | ||
| @@ -560,12 +558,10 @@ void CopyDir(const std::string &source_path, const std::string &dest_path) | |||
| 560 | if (!FileUtil::Exists(source_path)) return; | 558 | if (!FileUtil::Exists(source_path)) return; |
| 561 | if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path); | 559 | if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path); |
| 562 | 560 | ||
| 563 | struct dirent dirent, *result = nullptr; | ||
| 564 | DIR *dirp = opendir(source_path.c_str()); | 561 | DIR *dirp = opendir(source_path.c_str()); |
| 565 | if (!dirp) return; | 562 | if (!dirp) return; |
| 566 | 563 | ||
| 567 | while (!readdir_r(dirp, &dirent, &result) && result) | 564 | while (struct dirent* result = readdir(dirp)) { |
| 568 | { | ||
| 569 | const std::string virtualName(result->d_name); | 565 | const std::string virtualName(result->d_name); |
| 570 | // check for "." and ".." | 566 | // check for "." and ".." |
| 571 | if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || | 567 | if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || |