changeset 2593:cc2befdc97e8

iOS: Switch to using the NSURL fileSystemRepresentation method. This allows us to simplify the code automatically removing file:///.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 27 May 2021 23:34:23 +0000
parents dbb189c5d398
children 2c15b3d41fe4
files ios/dw.m
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Tue May 25 15:38:55 2021 +0000
+++ b/ios/dw.m	Thu May 27 23:34:23 2021 +0000
@@ -941,18 +941,12 @@
     NSURL *url = [urls firstObject];
     char *file = NULL;
 
-    if(url && [[url absoluteString] length] > 0)
-    {
-        const char *tmp = [[url absoluteString] UTF8String];
+    if(url)
+    {
+        const char *tmp = [url fileSystemRepresentation];
 
         if(tmp)
-        {
-            /* Strip off file:// so it looks the same as other platforms */
-            if(strncmp(tmp, "file://", 7) == 0)
-                file = strdup(&tmp[7]);
-            else
-                file = strdup(tmp);
-        }
+            file = strdup(tmp);
     }
     dw_dialog_dismiss(dialog, file);
 }