Commit 297c8d3f authored by Christian Hergert's avatar Christian Hergert
Browse files

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.
parent bdc1895c
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment