[gnome-builder] pipeline: allow removing _build directories
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] pipeline: allow removing _build directories
- Date: Tue, 16 Jan 2018 08:50:44 +0000 (UTC)
commit 297c8d3fd0e2dd5bc7cb9dfb397a85864561931d
Author: Christian Hergert <chergert redhat com>
Date: Tue Jan 16 00:43:09 2018 -0800
pipeline: allow removing _build directories
Special case, would be nice if this was abstracted but for now
we can just use the _build as convention.
src/libide/buildsystem/ide-build-pipeline.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/buildsystem/ide-build-pipeline.c b/src/libide/buildsystem/ide-build-pipeline.c
index 054c4b9b1..ddc4251ac 100644
--- a/src/libide/buildsystem/ide-build-pipeline.c
+++ b/src/libide/buildsystem/ide-build-pipeline.c
@@ -2846,6 +2846,7 @@ ide_build_pipeline_clean_finish (IdeBuildPipeline *self,
static gboolean
can_remove_builddir (IdeBuildPipeline *self)
{
+ g_autofree gchar *name = NULL;
g_autoptr(GFile) builddir = NULL;
g_autoptr(GFile) cache = NULL;
@@ -2855,12 +2856,23 @@ can_remove_builddir (IdeBuildPipeline *self)
* Only remove builddir if it is in ~/.cache/ or our XDG data dirs
* equivalent. We don't want to accidentally remove data that might
* be important to the user.
+ *
+ * However, if the build dir is our special case "_build" inside the
+ * project directory, we'll allow that too.
*/
cache = g_file_new_for_path (g_get_user_cache_dir ());
builddir = g_file_new_for_path (self->builddir);
+ if (g_file_has_prefix (builddir, cache))
+ return TRUE;
+
+ name = g_path_get_basename (self->builddir);
+ if (dzl_str_equal0 (name, "_build"))
+ return TRUE;
- return g_file_has_prefix (builddir, cache);
+ g_debug ("%s is not in a cache directory, will not delete it", self->builddir);
+
+ return FALSE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]