| @@ -1,35 +1,36 @@ | | | @@ -1,35 +1,36 @@ |
1 | $NetBSD: patch-ad,v 1.1 2008/12/05 16:31:52 tron Exp $ | | 1 | $NetBSD: patch-ad,v 1.2 2008/12/16 16:49:52 tron Exp $ |
2 | | | 2 | |
3 | --- src/utils/directory.cc.orig 2008-12-05 13:20:16 +0100 | | 3 | --- src/utils/directory.cc.orig 2008-05-07 13:19:11.000000000 +0100 |
4 | +++ src/utils/directory.cc 2008-12-05 13:27:27 +0100 | | 4 | +++ src/utils/directory.cc 2008-12-16 16:45:58.000000000 +0000 |
5 | @@ -38,6 +38,7 @@ | | 5 | @@ -38,6 +38,7 @@ |
6 | | | 6 | |
7 | #include <algorithm> | | 7 | #include <algorithm> |
8 | #include <functional> | | 8 | #include <functional> |
9 | +#include <sys/stat.h> | | 9 | +#include <sys/stat.h> |
10 | #include <dirent.h> | | 10 | #include <dirent.h> |
11 | #include <rak/path.h> | | 11 | #include <rak/path.h> |
12 | #include <torrent/exceptions.h> | | 12 | #include <torrent/exceptions.h> |
13 | @@ -63,6 +64,8 @@ | | 13 | @@ -63,7 +64,9 @@ |
14 | if (m_path.empty()) | | 14 | if (m_path.empty()) |
15 | throw torrent::input_error("Directory::update() tried to open an empty path."); | | 15 | throw torrent::input_error("Directory::update() tried to open an empty path."); |
16 | | | 16 | |
| | | 17 | - DIR* d = opendir(rak::path_expand(m_path).c_str()); |
17 | + std::string path=rak::path_expand(m_path); | | 18 | + std::string path=rak::path_expand(m_path); |
18 | + | | 19 | + |
19 | - DIR* d = opendir(rak::path_expand(m_path).c_str()); | | | |
20 | + DIR* d = opendir(path.c_str()); | | 20 | + DIR* d = opendir(path.c_str()); |
21 | | | 21 | |
22 | if (d == NULL) | | 22 | if (d == NULL) |
| | | 23 | return false; |
23 | @@ -73,12 +76,18 @@ | | 24 | @@ -73,12 +76,18 @@ |
24 | while ((entry = readdir(d)) != NULL) { | | 25 | while ((entry = readdir(d)) != NULL) { |
25 | if ((flags & update_hide_dot) && entry->d_name[0] == '.') | | 26 | if ((flags & update_hide_dot) && entry->d_name[0] == '.') |
26 | continue; | | 27 | continue; |
27 | + | | 28 | + |
28 | + std::string full_path = path + '/'; | | 29 | + std::string full_path = path + '/'; |
29 | + full_path += entry->d_name; | | 30 | + full_path += entry->d_name; |
30 | + | | 31 | + |
31 | + struct stat sb; | | 32 | + struct stat sb; |
32 | + if (stat(full_path.c_str(), &sb)) | | 33 | + if (stat(full_path.c_str(), &sb)) |
33 | + continue; | | 34 | + continue; |
34 | | | 35 | |
35 | iterator itr = base_type::insert(end(), value_type()); | | 36 | iterator itr = base_type::insert(end(), value_type()); |