From 0fcb7dc65cea3c72fad8a8b261f5a6a324a3bd33 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 28 Feb 2009 14:02:08 +0100 Subject: update: use G_FILE_TEST_IS_REGULAR for archive files When checking whether database entries have been deleted, don't check if an archive file is a directory (G_FILE_TEST_IS_DIR), use G_FILE_TEST_IS_REGULAR for this case instead. To determine if a "struct directory" is an archive, check for device==DEVICE_INARCHIVE. This is always false after loading the database, so this patch is not complete yet. --- src/update.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/update.c b/src/update.c index 5cb02cb4e..e72c2e26d 100644 --- a/src/update.c +++ b/src/update.c @@ -205,6 +205,7 @@ static bool directory_exists(const struct directory *directory) { char *path_fs; + GFileTest test; bool exists; path_fs = map_directory_fs(directory); @@ -212,7 +213,11 @@ directory_exists(const struct directory *directory) /* invalid path: cannot exist */ return false; - exists = g_file_test(path_fs, G_FILE_TEST_IS_DIR); + test = directory->device == DEVICE_INARCHIVE + ? G_FILE_TEST_IS_REGULAR + : G_FILE_TEST_IS_DIR; + + exists = g_file_test(path_fs, test); g_free(path_fs); return exists; -- cgit v1.2.3