[gnome-builder] ctags: put ctags files in project cache dir
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] ctags: put ctags files in project cache dir
- Date: Tue, 21 Nov 2017 08:08:54 +0000 (UTC)
commit 473066932d81f7f112e1ccdb0ab3e905e2dc1088
Author: Christian Hergert <chergert redhat com>
Date: Tue Nov 21 00:08:13 2017 -0800
ctags: put ctags files in project cache dir
This uses the cache dir for the project so that reaping files
at purge time is simpler.
src/plugins/ctags/ide-ctags-builder.c | 18 ++++++------------
src/plugins/ctags/ide-ctags-service.c | 10 ++--------
2 files changed, 8 insertions(+), 20 deletions(-)
---
diff --git a/src/plugins/ctags/ide-ctags-builder.c b/src/plugins/ctags/ide-ctags-builder.c
index add7f49..f393546 100644
--- a/src/plugins/ctags/ide-ctags-builder.c
+++ b/src/plugins/ctags/ide-ctags-builder.c
@@ -289,7 +289,6 @@ ide_ctags_builder_build_async (IdeTagsBuilder *builder,
g_autofree gchar *relative_path = NULL;
BuildTaskData *task_data;
IdeContext *context;
- const gchar *project_id;
GFile *workdir;
IDE_ENTRY;
@@ -305,26 +304,21 @@ ide_ctags_builder_build_async (IdeTagsBuilder *builder,
task_data->recursive = recursive;
/*
- * The destination directory for the tags should match the hierarchy
- * of the projects source tree, but be based in something like
- * ~/.cache/gnome-builder/tags/$project_id/ so that they can be reused
- * even between configuration changes. Primarily, we want to avoid
+ * The destination directory for the tags should match the hierarchy of the
+ * projects source tree, but be based in something like
+ * ~/.cache/gnome-builder/projects/$project_id/ctags/ so that they can be
+ * reused even between configuration changes. Primarily, we want to avoid
* putting things in the source tree.
*/
context = ide_object_get_context (IDE_OBJECT (self));
- project_id = ide_project_get_id (ide_context_get_project (context));
workdir = ide_vcs_get_working_directory (ide_context_get_vcs (context));
relative_path = g_file_get_relative_path (workdir, directory_or_file);
- destination_path = g_build_filename (g_get_user_cache_dir (),
- ide_get_program_name (),
- "tags",
- project_id,
- relative_path,
- NULL);
+ destination_path = ide_context_cache_filename (context, "ctags", relative_path, NULL);
task_data->destination = g_file_new_for_path (destination_path);
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, ide_ctags_builder_build_async);
+ g_task_set_priority (task, G_PRIORITY_LOW);
g_task_set_task_data (task, task_data, build_task_data_free);
ide_thread_pool_push_task (IDE_THREAD_POOL_INDEXER, task, ide_ctags_builder_build_worker);
diff --git a/src/plugins/ctags/ide-ctags-service.c b/src/plugins/ctags/ide-ctags-service.c
index a5e590c..30b6c87 100644
--- a/src/plugins/ctags/ide-ctags-service.c
+++ b/src/plugins/ctags/ide-ctags-service.c
@@ -384,7 +384,6 @@ ide_ctags_service_do_mine (gpointer data)
g_autoptr(GArray) mine_info = NULL;
g_autofree gchar *path = NULL;
IdeContext *context;
- IdeProject *project;
MineInfo info;
GFile *workdir;
@@ -396,18 +395,13 @@ ide_ctags_service_do_mine (gpointer data)
self->miner_active = TRUE;
context = ide_object_get_context (IDE_OBJECT (self));
- project = ide_context_get_project (context);
workdir = ide_vcs_get_working_directory (ide_context_get_vcs (context));
mine_info = g_array_new (FALSE, FALSE, sizeof (MineInfo));
g_array_set_clear_func (mine_info, clear_mine_info);
- /* mine: ~/.cache/gnome-builder/tags/$project_id */
- info.path = g_build_filename (g_get_user_cache_dir (),
- ide_get_program_name (),
- "tags",
- ide_project_get_id (project),
- NULL);
+ /* mine: ~/.cache/gnome-builder/projects/$project_id/ctags/ */
+ info.path = ide_context_cache_filename (context, "ctags", NULL);
info.recursive = TRUE;
g_array_append_val (mine_info, info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]