[Libreoffice-commits] .: sal/android

Tor Lillqvist tml at kemper.freedesktop.org
Mon Feb 20 10:13:54 PST 2012


 sal/android/lo-bootstrap.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit e14fea9f37033c918380df7ad4d4237052208eae
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Mon Feb 20 20:02:25 2012 +0200

    Work around the fact that empty directories are not present in an .apk
    
    The SDK tooling that constructs .apk packages doesn't put empty
    directories in them. Which makes sense I guess. "Hidden" files (like
    .gitignore) are also skipped. So a directory like
    sc/qa/unit/qpro/indeterminate does not show up at all.
    
    So, we must pretend that any opendir() of a directory under /assets
    succeeds. If the .apk doesn't contain any files in such a directory,
    treat it as existing but empty. We can't know if the corresponding
    directory from which /assets was constructed actually does exist but
    is empty or if it doesn't exist.

diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index 1140515..96d6058 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -1030,9 +1030,19 @@ lo_apk_opendir(const char *dirname)
 
         HASH_FIND(hh, dir, p, (unsigned)(q - p), entry);
 
-        if (entry == NULL) {
+        if (entry == NULL && *q == '/') {
             errno = ENOENT;
             return NULL;
+        } else if (entry == NULL) {
+            /* Empty directories, or directories containing only "hidden"
+             * files (like the .gitignore in sc/qa/unit/qpro/indeterminate)
+             * are not present in the .apk. So we need to pretend that any
+             * directory that doesn't exist as a parent of an entry in the
+             * .apk *does* exist but is empty.
+             */
+            lo_apk_dir *result = malloc(sizeof(*result));
+            result->cur = NULL;
+            return result;
         }
 
         if (entry->kind != DIRECTORY) {


More information about the Libreoffice-commits mailing list