forked from Mirrors/flatpak-builder
Merge pull request #98 from ssssam/dont-delete-appdir
builder: Don't delete the APPDIR directorytingping/wmclass
commit
cb571dab52
|
@ -219,3 +219,19 @@ gboolean is_elf_file (const char *path,
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean directory_is_empty (const char *path)
|
||||
{
|
||||
GDir *dir;
|
||||
gboolean empty;
|
||||
|
||||
dir = g_dir_open (path, 0, NULL);
|
||||
if (g_dir_read_name (dir) == NULL)
|
||||
empty = TRUE;
|
||||
else
|
||||
empty = FALSE;
|
||||
|
||||
g_dir_close (dir);
|
||||
|
||||
return empty;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ gboolean is_elf_file (const char *path,
|
|||
gboolean *is_shared,
|
||||
gboolean *is_stripped);
|
||||
|
||||
gboolean directory_is_empty (const char *path);
|
||||
|
||||
gboolean xdg_app_matches_path_pattern (const char *path,
|
||||
const char *pattern);
|
||||
void xdg_app_collect_matches_for_path_pattern (const char *path,
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "libgsystem.h"
|
||||
|
||||
#include "builder-manifest.h"
|
||||
#include "builder-utils.h"
|
||||
|
||||
static gboolean opt_verbose;
|
||||
static gboolean opt_version;
|
||||
|
@ -210,9 +211,10 @@ main (int argc,
|
|||
base_dir = g_file_new_for_path (g_get_current_dir ());
|
||||
app_dir = g_file_new_for_path (app_dir_path);
|
||||
|
||||
if (!gs_shutil_rm_rf (app_dir, NULL, &error))
|
||||
if (g_file_query_exists (app_dir, NULL) && !directory_is_empty (app_dir_path))
|
||||
{
|
||||
g_print ("error removing old app dir '%s': %s\n", app_dir_path, error->message);
|
||||
g_printerr ("App dir '%s' is not empty. Please delete "
|
||||
"the existing contents.\n", app_dir_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue