MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / prune_logs

Function prune_logs

gtk/src/callbacks.c:4231–4272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4229}
4230
4231static void
4232prune_logs (void)
4233{
4234 gchar *dest_dir;
4235 gint days;
4236 signal_user_data_t *ud = ghb_ud();
4237
4238 // Only prune logs stored in the default config dir location
4239 days = ghb_settings_combo_int(ud->prefs, "LogLongevity");
4240 if (days > 365)
4241 return;
4242
4243 dest_dir = ghb_get_user_config_dir("EncodeLogs");
4244 if (g_file_test(dest_dir, G_FILE_TEST_IS_DIR))
4245 {
4246 const gchar *file;
4247 gint duration = days * 24 * 60 * 60;
4248
4249 GDir *gdir = g_dir_open(dest_dir, 0, NULL);
4250 time_t now;
4251
4252 now = time(NULL);
4253 file = g_dir_read_name(gdir);
4254 while (file)
4255 {
4256 gchar *path;
4257 GStatBuf stbuf;
4258
4259 path = g_strdup_printf("%s/%s", dest_dir, file);
4260 g_stat(path, &stbuf);
4261 if (now - stbuf.st_mtime > duration)
4262 {
4263 g_unlink(path);
4264 }
4265 g_free(path);
4266 file = g_dir_read_name(gdir);
4267 }
4268 g_dir_close(gdir);
4269 }
4270 g_free(dest_dir);
4271 ghb_preview_cleanup(ud);
4272}
4273
4274static gint
4275queue_pending_count(GhbValue *queue)

Callers 6

application_quitFunction · 0.85
ghb_do_scan_listFunction · 0.85
ghb_do_scanFunction · 0.85
shutdown_cbFunction · 0.85
handle_media_changeFunction · 0.85
drive_changed_cbFunction · 0.85

Calls 4

ghb_udFunction · 0.85
ghb_settings_combo_intFunction · 0.85
ghb_get_user_config_dirFunction · 0.85
ghb_preview_cleanupFunction · 0.85

Tested by

no test coverage detected