[tracker-miners/wip/carlosg/cli-improvements: 30/30] tracker: Ensure to reset all ancillary files in "tracker3 reset"
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/cli-improvements: 30/30] tracker: Ensure to reset all ancillary files in "tracker3 reset"
- Date: Tue, 18 Aug 2020 10:37:41 +0000 (UTC)
commit 794b29485c64d4f855b4f65c9f8dc2a121adfef5
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Aug 18 11:50:51 2020 +0200
tracker: Ensure to reset all ancillary files in "tracker3 reset"
We just deleted database files, but that leaves out ontologies.gvdb,
the brand new location for persistent errors, and the several timestamp
files used by miner-fs.
Ensure that a reset removes them all.
src/tracker/tracker-reset.c | 42 ++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/src/tracker/tracker-reset.c b/src/tracker/tracker-reset.c
index 1359363c1..368ed2a0b 100644
--- a/src/tracker/tracker-reset.c
+++ b/src/tracker/tracker-reset.c
@@ -132,7 +132,7 @@ error:
}
static void
-delete_databases (GFile *dir)
+delete_location_content (GFile *dir)
{
GFileEnumerator *enumerator;
GError *error = NULL;
@@ -150,26 +150,18 @@ delete_databases (GFile *dir)
}
while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) {
- const gchar *name;
GFile *child;
- name = g_file_info_get_name (info);
+ child = g_file_enumerator_get_child (enumerator, info);
- /* Delete sqlite files in the location */
- if (g_str_has_suffix (name, ".db") ||
- g_str_has_suffix (name, ".db-wal") ||
- g_str_has_suffix (name, ".db-shm")) {
- child = g_file_enumerator_get_child (enumerator, info);
-
- if (!g_file_delete (child, NULL, &error)) {
- g_critical ("Failed to delete '%s': %s",
- g_file_info_get_name (info),
- error->message);
- g_error_free (error);
- }
-
- g_object_unref (child);
+ if (!g_file_delete (child, NULL, &error)) {
+ g_critical ("Failed to delete '%s': %s",
+ g_file_info_get_name (info),
+ error->message);
+ g_error_free (error);
}
+
+ g_object_unref (child);
}
g_object_unref (enumerator);
@@ -195,13 +187,19 @@ reset_run (void)
}
if (files) {
- GFile *cache_location;
+ GFile *location;
gchar *dir;
+ dir = g_build_filename (g_get_user_cache_dir (), "tracker3", "files", "errors", NULL);
+ location = g_file_new_for_path (dir);
+ delete_location_content (location);
+ g_object_unref (location);
+ g_free (dir);
+
dir = g_build_filename (g_get_user_cache_dir (), "tracker3", "files", NULL);
- cache_location = g_file_new_for_path (dir);
- delete_databases (cache_location);
- g_object_unref (cache_location);
+ location = g_file_new_for_path (dir);
+ delete_location_content (location);
+ g_object_unref (location);
g_free (dir);
}
@@ -211,7 +209,7 @@ reset_run (void)
dir = g_build_filename (g_get_user_cache_dir (), "tracker3", "rss", NULL);
cache_location = g_file_new_for_path (dir);
- delete_databases (cache_location);
+ delete_location_content (cache_location);
g_object_unref (cache_location);
g_free (dir);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]