changeset 368:c186fd33d969

Android: Switch to using dw_file_open() and xmlReadFd() to open the XML files. This may or may not be a temporary solution as I work out options on Android.
author Brian Smith <brian@dbsoft.org>
date Wed, 13 Jul 2022 10:00:20 -0500
parents 9da6d6760545
children 9d8a55a1c7a6
files dwib.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dwib.c	Mon Jul 11 17:19:12 2022 -0500
+++ b/dwib.c	Wed Jul 13 10:00:20 2022 -0500
@@ -5680,8 +5680,10 @@
     {
         char *filename = data ? (char *)data : dw_file_browse("Open interface", ".", "xml", DW_FILE_OPEN);
         xmlDocPtr doc;
-        
-        if(filename && (doc = xmlParseFile(filename)))
+        int fd = -1;
+
+        if(filename && (fd = dw_file_open(filename, O_RDONLY)) > -1 &&
+                (doc = xmlReadFd(fd, filename, NULL, 0)))
         {
             char *tmpptr, *oldfilename = DWFullFilename;
             xmlNodePtr imageNode;
@@ -5746,6 +5748,8 @@
         } else if(filename) {
             dw_messagebox("File open error", DW_MB_OK | DW_MB_ERROR, "Failed to open \"%s\".", filename);
         }
+        if(fd > -1)
+            close(fd);
     }
     return FALSE;
 }