comparison ios/dw.m @ 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 f3d423cdbc2e
children 4a5364fe65b7
comparison
equal deleted inserted replaced
2592:dbb189c5d398 2593:cc2befdc97e8
939 -(void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls 939 -(void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls
940 { 940 {
941 NSURL *url = [urls firstObject]; 941 NSURL *url = [urls firstObject];
942 char *file = NULL; 942 char *file = NULL;
943 943
944 if(url && [[url absoluteString] length] > 0) 944 if(url)
945 { 945 {
946 const char *tmp = [[url absoluteString] UTF8String]; 946 const char *tmp = [url fileSystemRepresentation];
947 947
948 if(tmp) 948 if(tmp)
949 { 949 file = strdup(tmp);
950 /* Strip off file:// so it looks the same as other platforms */
951 if(strncmp(tmp, "file://", 7) == 0)
952 file = strdup(&tmp[7]);
953 else
954 file = strdup(tmp);
955 }
956 } 950 }
957 dw_dialog_dismiss(dialog, file); 951 dw_dialog_dismiss(dialog, file);
958 } 952 }
959 -(void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller 953 -(void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller
960 { 954 {