changeset 370:58b12b3534d6

Android: Add special case code for parsing the short filename from an Android storage URI, which can now be retuned by dw_file_browse().
author Brian Smith <brian@dbsoft.org>
date Fri, 15 Jul 2022 06:51:26 -0500
parents 9d8a55a1c7a6
children 8bc96e1b7d3f
files dwib.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dwib.c	Thu Jul 14 18:11:40 2022 -0500
+++ b/dwib.c	Fri Jul 15 06:51:26 2022 -0500
@@ -5312,7 +5312,16 @@
 
         /* Trim off the path using Unix or DOS format */
         DWFullFilename = strdup(filename);
-        tmpptr = strrchr(DWFullFilename, '/');
+#ifdef __ANDROID__
+        /* Handle special Android URI case of : encoded as %3A */
+        tmpptr = strrchr(DWFullFilename, '%');
+        if(tmpptr && *(tmpptr+1) == '3' && *(tmpptr+2) == 'A')
+            tmpptr += 2;
+        else
+            tmpptr = 0;
+        if(!tmpptr)
+#endif
+            tmpptr = strrchr(DWFullFilename, '/');
         if(!tmpptr)
             tmpptr = strrchr(DWFullFilename, '\\');
         /* Copy the short filename */