mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
Adds new Folder option in ROM list.
This commit is contained in:
parent
1d99eac1ec
commit
622702eb92
@ -42,10 +42,9 @@
|
||||
NSString* ragPath = [rootPath stringByAppendingPathComponent:@"RetroArchGames"];
|
||||
|
||||
RADirectoryList* list = [RADirectoryList directoryListForPath:path_is_directory(ragPath.UTF8String) ? ragPath : rootPath];
|
||||
list.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Refresh"
|
||||
style:UIBarButtonItemStyleBordered
|
||||
target:list
|
||||
action:@selector(refresh)];
|
||||
|
||||
list.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:list action:@selector(createNewFolder)];
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
@ -173,6 +172,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createNewFolder {
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Enter new folder name" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
|
||||
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
|
||||
[alertView show];
|
||||
}
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
|
||||
NSString *text = [[alertView textFieldAtIndex:0] text];
|
||||
|
||||
if (buttonIndex == 1 && ![text isEqualToString:@""]) {
|
||||
NSString *directoryPath = [_path stringByAppendingPathComponent:text];
|
||||
BOOL didCreateFolder = [[NSFileManager defaultManager] createDirectoryAtPath:directoryPath withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
|
||||
if (didCreateFolder) {
|
||||
[self refresh];
|
||||
} else {
|
||||
apple_display_alert(@"Not possible to create folder.", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation RAModuleList
|
||||
|
Loading…
x
Reference in New Issue
Block a user