summaryrefslogtreecommitdiff
path: root/apps/plugins/properties.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/properties.c')
-rw-r--r--apps/plugins/properties.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 3b4f2797af..86817e2cc7 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -59,30 +59,18 @@ static bool file_properties(char* selected_file)
59{ 59{
60 bool found = false; 60 bool found = false;
61 char tstr[MAX_PATH]; 61 char tstr[MAX_PATH];
62#ifdef HAVE_DIRCACHE
63 DIRCACHED* dir;
64 struct dircache_entry* entry;
65#else
66 DIR* dir; 62 DIR* dir;
67 struct dirent* entry; 63 struct dirent* entry;
68#endif 64
69 char* ptr = rb->strrchr(selected_file, '/') + 1; 65 char* ptr = rb->strrchr(selected_file, '/') + 1;
70 int dirlen = (ptr - selected_file); 66 int dirlen = (ptr - selected_file);
71 rb->strncpy(tstr, selected_file, dirlen); 67 rb->strncpy(tstr, selected_file, dirlen);
72 tstr[dirlen] = 0; 68 tstr[dirlen] = 0;
73 69
74#ifdef HAVE_DIRCACHE
75 dir = rb->opendir_cached(tstr);
76#else
77 dir = rb->opendir(tstr); 70 dir = rb->opendir(tstr);
78#endif
79 if (dir) 71 if (dir)
80 { 72 {
81#ifdef HAVE_DIRCACHE
82 while(0 != (entry = rb->readdir_cached(dir)))
83#else
84 while(0 != (entry = rb->readdir(dir))) 73 while(0 != (entry = rb->readdir(dir)))
85#endif
86 { 74 {
87 if(!rb->strcmp(entry->d_name, selected_file+dirlen)) 75 if(!rb->strcmp(entry->d_name, selected_file+dirlen))
88 { 76 {
@@ -103,11 +91,7 @@ static bool file_properties(char* selected_file)
103 break; 91 break;
104 } 92 }
105 } 93 }
106#ifdef HAVE_DIRCACHE
107 rb->closedir_cached(dir);
108#else
109 rb->closedir(dir); 94 rb->closedir(dir);
110#endif
111 } 95 }
112 return found; 96 return found;
113} 97}
@@ -128,30 +112,17 @@ static bool _dir_properties(DPS* dps)
128 and informs the user of the progress */ 112 and informs the user of the progress */
129 bool result; 113 bool result;
130 int dirlen; 114 int dirlen;
131#ifdef HAVE_DIRCACHE
132 DIRCACHED* dir;
133 struct dircache_entry* entry;
134#else
135 DIR* dir; 115 DIR* dir;
136 struct dirent* entry; 116 struct dirent* entry;
137#endif
138 117
139 result = true; 118 result = true;
140 dirlen = rb->strlen(dps->dirname); 119 dirlen = rb->strlen(dps->dirname);
141#ifdef HAVE_DIRCACHE
142 dir = rb->opendir_cached(dps->dirname);
143#else
144 dir = rb->opendir(dps->dirname); 120 dir = rb->opendir(dps->dirname);
145#endif
146 if (!dir) 121 if (!dir)
147 return false; /* open error */ 122 return false; /* open error */
148 123
149 /* walk through the directory content */ 124 /* walk through the directory content */
150#ifdef HAVE_DIRCACHE
151 while(result && (0 != (entry = rb->readdir_cached(dir))))
152#else
153 while(result && (0 != (entry = rb->readdir(dir)))) 125 while(result && (0 != (entry = rb->readdir(dir))))
154#endif
155 { 126 {
156 /* append name to current directory */ 127 /* append name to current directory */
157 rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s", 128 rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s",
@@ -189,12 +160,7 @@ static bool _dir_properties(DPS* dps)
189 result = false; 160 result = false;
190 rb->yield(); 161 rb->yield();
191 } 162 }
192#ifdef HAVE_DIRCACHE
193 rb->closedir_cached(dir);
194#else
195 rb->closedir(dir); 163 rb->closedir(dir);
196#endif
197
198 return result; 164 return result;
199} 165}
200 166
@@ -256,30 +222,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
256 222
257 /* determine if it's a file or a directory */ 223 /* determine if it's a file or a directory */
258 bool found = false; 224 bool found = false;
259#ifdef HAVE_DIRCACHE
260 DIRCACHED* dir;
261 struct dircache_entry* entry;
262#else
263 DIR* dir; 225 DIR* dir;
264 struct dirent* entry; 226 struct dirent* entry;
265#endif
266 char* ptr = rb->strrchr((char*)file, '/') + 1; 227 char* ptr = rb->strrchr((char*)file, '/') + 1;
267 int dirlen = (ptr - (char*)file); 228 int dirlen = (ptr - (char*)file);
268 rb->strncpy(str_dirname, (char*)file, dirlen); 229 rb->strncpy(str_dirname, (char*)file, dirlen);
269 str_dirname[dirlen] = 0; 230 str_dirname[dirlen] = 0;
270 231
271#ifdef HAVE_DIRCACHE
272 dir = rb->opendir_cached(str_dirname);
273#else
274 dir = rb->opendir(str_dirname); 232 dir = rb->opendir(str_dirname);
275#endif
276 if (dir) 233 if (dir)
277 { 234 {
278#ifdef HAVE_DIRCACHE
279 while(0 != (entry = rb->readdir_cached(dir)))
280#else
281 while(0 != (entry = rb->readdir(dir))) 235 while(0 != (entry = rb->readdir(dir)))
282#endif
283 { 236 {
284 if(!rb->strcmp(entry->d_name, file+dirlen)) 237 if(!rb->strcmp(entry->d_name, file+dirlen))
285 { 238 {
@@ -288,11 +241,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
288 break; 241 break;
289 } 242 }
290 } 243 }
291#ifdef HAVE_DIRCACHE
292 rb->closedir_cached(dir);
293#else
294 rb->closedir(dir); 244 rb->closedir(dir);
295#endif
296 } 245 }
297 /* now we know if it's a file or a dir or maybe something failed */ 246 /* now we know if it's a file or a dir or maybe something failed */
298 247