comparison src/cache_maint.c @ 673:fbebf5cf4a55

Do not use printf() directly but use new wrapper function log_printf() instead.
author zas_
date Fri, 16 May 2008 12:16:49 +0000
parents 8268cbe682f1
children cca86176bf81
comparison
equal deleted inserted replaced
672:913eb0ba99a6 673:fbebf5cf4a55
187 if (dot) *dot = '\0'; 187 if (dot) *dot = '\0';
188 if ((!cm->metadata && cm->clear) || 188 if ((!cm->metadata && cm->clear) ||
189 (strlen(path_buf) > base_length && !isfile(path_buf + base_length)) ) 189 (strlen(path_buf) > base_length && !isfile(path_buf + base_length)) )
190 { 190 {
191 if (dot) *dot = '.'; 191 if (dot) *dot = '.';
192 if (!unlink_file(path_buf)) printf("failed to delete:%s\n", path_buf); 192 if (!unlink_file(path_buf)) log_printf("failed to delete:%s\n", path_buf);
193 } 193 }
194 else 194 else
195 { 195 {
196 still_have_a_file = TRUE; 196 still_have_a_file = TRUE;
197 } 197 }
210 210
211 if (cm->list->data == fd && just_done) 211 if (cm->list->data == fd && just_done)
212 { 212 {
213 if (!still_have_a_file && !dlist && cm->list->next && !rmdir_utf8(fd->path)) 213 if (!still_have_a_file && !dlist && cm->list->next && !rmdir_utf8(fd->path))
214 { 214 {
215 printf("Unable to delete dir: %s\n", fd->path); 215 log_printf("Unable to delete dir: %s\n", fd->path);
216 } 216 }
217 } 217 }
218 else 218 else
219 { 219 {
220 /* must re-check for an empty dir */ 220 /* must re-check for an empty dir */
221 if (isempty(fd->path) && cm->list->next && !rmdir_utf8(fd->path)) 221 if (isempty(fd->path) && cm->list->next && !rmdir_utf8(fd->path))
222 { 222 {
223 printf("Unable to delete dir: %s\n", fd->path); 223 log_printf("Unable to delete dir: %s\n", fd->path);
224 } 224 }
225 } 225 }
226 226
227 fd = cm->list->data; 227 fd = cm->list->data;
228 cm->done_list = g_list_remove(cm->done_list, fd); 228 cm->done_list = g_list_remove(cm->done_list, fd);
375 !cache_maintain_home_dir(fd->path + base_length, recursive, clear)) 375 !cache_maintain_home_dir(fd->path + base_length, recursive, clear))
376 { 376 {
377 DEBUG_1("Deleting thumb dir: %s", fd->path); 377 DEBUG_1("Deleting thumb dir: %s", fd->path);
378 if (!rmdir_utf8(fd->path)) 378 if (!rmdir_utf8(fd->path))
379 { 379 {
380 printf("Unable to delete dir: %s\n", fd->path); 380 log_printf("Unable to delete dir: %s\n", fd->path);
381 } 381 }
382 } 382 }
383 else 383 else
384 { 384 {
385 still_have_a_file = TRUE; 385 still_have_a_file = TRUE;
399 if (dot) *dot = '\0'; 399 if (dot) *dot = '\0';
400 if (clear || 400 if (clear ||
401 (strlen(path) > base_length && !isfile(path + base_length)) ) 401 (strlen(path) > base_length && !isfile(path + base_length)) )
402 { 402 {
403 if (dot) *dot = '.'; 403 if (dot) *dot = '.';
404 if (!unlink_file(path)) printf("failed to delete:%s\n", path); 404 if (!unlink_file(path)) log_printf("failed to delete:%s\n", path);
405 } 405 }
406 else 406 else
407 { 407 {
408 still_have_a_file = TRUE; 408 still_have_a_file = TRUE;
409 } 409 }
531 g_free(d); 531 g_free(d);
532 g_free(buf); 532 g_free(buf);
533 } 533 }
534 else 534 else
535 { 535 {
536 printf("Failed to create cache dir for move %s\n", base); 536 log_printf("Failed to create cache dir for move %s\n", base);
537 } 537 }
538 g_free(base); 538 g_free(base);
539 539
540 base = cache_get_location(CACHE_TYPE_METADATA, dest, FALSE, &mode); 540 base = cache_get_location(CACHE_TYPE_METADATA, dest, FALSE, &mode);
541 if (cache_ensure_dir_exists(base, mode)) 541 if (cache_ensure_dir_exists(base, mode))