From bdac9e9717e747877b1eaf9fc78f12e909f88929 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Wed, 26 Nov 2014 14:24:18 -0500 Subject: [PATCH] Fixing Use Empty Path on directory settings --- apple/iOS/menu.m | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index 16a966ed4c..45863e2b36 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -416,16 +416,23 @@ static void RunActionSheet(const char* title, const struct string_list* items, U list = [[RADirectoryList alloc] initWithPath:path extensions:self.setting->values action: ^(RADirectoryList* list, RADirectoryItem* item) { - if (!list.allowBlank && !item) + const char *newval = NULL; + if (item) { + if (list.forDirectory && !item.isDirectory) return; - - if (list.forDirectory && !item.isDirectory) + + newval = [item.path UTF8String]; + } else { + if (!list.allowBlank) return; + + newval = ""; + } + + setting_data_set_with_string_representation(weakSelf.setting, newval); + [[list navigationController] popViewControllerAnimated:YES]; - setting_data_set_with_string_representation(weakSelf.setting, item ? [item.path UTF8String] : ""); - [[list navigationController] popViewControllerAnimated:YES]; - - [weakSelf.parentTable reloadData]; + [weakSelf.parentTable reloadData]; }]; list.allowBlank = (self.setting->flags & SD_FLAG_ALLOW_EMPTY);