[Sugar-devel] [PATCH 4/7] metadatareader: ignore ".hidden" files

Martin Langhoff martin at laptop.org
Thu Sep 20 23:55:37 EDT 2012


Ignore any file with a filename starting with a '.' -- metadatastore
writes its tempfiles prefixed with a '.' .

Signed-off-by: Martin Langhoff <martin at laptop.org>
---
Note: this one needs a bit of testing.

---
 src/carquinyol/metadatareader.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/carquinyol/metadatareader.c b/src/carquinyol/metadatareader.c
index d053a22..ee546f3 100644
--- a/src/carquinyol/metadatareader.c
+++ b/src/carquinyol/metadatareader.c
@@ -161,11 +161,8 @@ static PyObject *read_all_properties (const char *metadata_path) {
 
     dir_entry = readdir (dir_stream);
     while (dir_entry != NULL) {
-        // Skip . and ..
-        if (dir_entry->d_name[0] == '.' &&
-                (strlen (dir_entry->d_name) == 1 ||
-                        (dir_entry->d_name[1] == '.' &&
-                                strlen (dir_entry->d_name) == 2)))
+        // Skip '.', '..', and any .hidden file
+        if (dir_entry->d_name[0] == '.')
             goto next_property;
 
         if (add_property (metadata_path, dir_entry->d_name, dict, 1) == 0)
-- 
1.7.10.4



More information about the Sugar-devel mailing list