Skip to content

Commit

Permalink
context: Create CACHEDIR.TAG file in state dir
Browse files Browse the repository at this point in the history
This makes it possible for backup software to detect and ignore the
whole folder.

Fixes flatpak#360
  • Loading branch information
Vanadiae committed Apr 25, 2023
1 parent 8bc51b6 commit d511474
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/builder-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,21 @@ builder_context_allocate_build_subdir (BuilderContext *self,
{
g_autoptr(GError) my_error = NULL;
int count;
g_autoptr (GFile) cachedir_tag = g_file_get_child (self->state_dir, "CACHEDIR.TAG");

if (!flatpak_mkdir_p (self->build_dir,
NULL, error))
return NULL;

const char *cachedir_tag_content = "Signature: 8a477f597d28d172789f06886806bc55\n"
"# This file is a cache directory tag created by flatpak-builder.\n"
"# For information about cache directory tags see https://bford.info/cachedir/";
if (!g_file_replace_contents (cachedir_tag, cachedir_tag_content,
strlen (cachedir_tag_content), NULL, FALSE,
G_FILE_CREATE_REPLACE_DESTINATION,
NULL, NULL, error))
return NULL;

for (count = 1; count < 1000; count++)
{
g_autofree char *buildname = NULL;
Expand Down

0 comments on commit d511474

Please sign in to comment.