diff --git a/platform/xcode/liblove.xcodeproj/project.pbxproj b/platform/xcode/liblove.xcodeproj/project.pbxproj index 652621b6b..9e3d337bd 100644 --- a/platform/xcode/liblove.xcodeproj/project.pbxproj +++ b/platform/xcode/liblove.xcodeproj/project.pbxproj @@ -1466,6 +1466,8 @@ FA0B7CCC1A95902C000E1D17 /* wrap_Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Window.h; sourceTree = ""; }; FA0B7EF01A959D2C000E1D17 /* iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iOS.h; sourceTree = ""; }; FA0B7EF11A959D2C000E1D17 /* iOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = iOS.mm; sourceTree = ""; }; + FA283EDC1B27CFAA00C70067 /* nogame.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = nogame.lua; sourceTree = ""; }; + FA283EDD1B27CFAA00C70067 /* nogame.lua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nogame.lua.h; sourceTree = ""; }; FA317EB918F28B6D00B0BCD7 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; FA4B66C81ABBCF1900558F15 /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = ""; }; FA577A6716C719D900860150 /* FreeType.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FreeType.framework; path = /Library/Frameworks/FreeType.framework; sourceTree = ""; }; @@ -1566,6 +1568,8 @@ 503971A86B7167A91B670FBA /* boot.lua.h */, FA577A8E16C71D3600860150 /* graphics.lua */, 104144AB73A974BC04A03131 /* graphics.lua.h */, + FA283EDC1B27CFAA00C70067 /* nogame.lua */, + FA283EDD1B27CFAA00C70067 /* nogame.lua.h */, ); name = scripts; path = ../../src/scripts; diff --git a/src/common/iOS.mm b/src/common/iOS.mm index c61db3526..297f463b0 100644 --- a/src/common/iOS.mm +++ b/src/common/iOS.mm @@ -148,35 +148,38 @@ static bool deleteFileInDocuments(NSString *filename) static int dropFileEventFilter(void *userdata, SDL_Event *event) { - if (event->type != SDL_DROPFILE) - return 1; - - NSString *fname = @(event->drop.file); - NSFileManager *fmanager = [NSFileManager defaultManager]; - - if ([fmanager fileExistsAtPath:fname] && [fname.pathExtension isEqual:@"love"]) + @autoreleasepool { - NSString *documents = getDocumentsDirectory(); + if (event->type != SDL_DROPFILE) + return 1; - documents = [[documents stringByStandardizingPath] stringByResolvingSymlinksInPath]; - fname = [[fname stringByStandardizingPath] stringByResolvingSymlinksInPath]; + NSString *fname = @(event->drop.file); + NSFileManager *fmanager = [NSFileManager defaultManager]; - // Is the file inside the Documents directory? - if ([fname hasPrefix:documents]) + if ([fmanager fileExistsAtPath:fname] && [fname.pathExtension isEqual:@"love"]) { - LOVETableViewController *vc = (__bridge LOVETableViewController *) userdata; + NSString *documents = getDocumentsDirectory(); - // Update the game list. - NSArray *games = getLovesInDocuments(); - vc.gameList = [[NSMutableArray alloc] initWithArray:games copyItems:YES]; - [vc.tableView reloadData]; + documents = documents.stringByStandardizingPath.stringByResolvingSymlinksInPath; + fname = fname.stringByStandardizingPath.stringByResolvingSymlinksInPath; - SDL_free(event->drop.file); - return 0; + // Is the file inside the Documents directory? + if ([fname hasPrefix:documents]) + { + LOVETableViewController *vc = (__bridge LOVETableViewController *) userdata; + + // Update the game list. + NSArray *games = getLovesInDocuments(); + vc.gameList = [[NSMutableArray alloc] initWithArray:games copyItems:YES]; + [vc.tableView reloadData]; + + SDL_free(event->drop.file); + return 0; + } } - } - return 1; + return 1; + } } namespace love @@ -245,7 +248,6 @@ std::string getLoveInResources(bool &fused) { // The game should be fused if we have something here. fused = true; - NSLog(@".love files in main Bundle: %@", bundlepaths); return [bundlepaths[0] UTF8String]; } @@ -253,9 +255,6 @@ std::string getLoveInResources(bool &fused) // fused. NSArray *filepaths = getLovesInDocuments(); - if (filepaths.count > 0) - NSLog(@".love files in Documents: %@", filepaths); - // Let the user select a game from the un-fused list. NSString *selectedfile = showGameList(filepaths); @@ -263,8 +262,7 @@ std::string getLoveInResources(bool &fused) if (selectedfile != nil && selectedfile.length > 0) { NSString *documents = getDocumentsDirectory(); - path = [[documents stringByAppendingPathComponent:selectedfile] UTF8String]; - NSLog(@"Using unfused .love file: %@", selectedfile); + path = [documents stringByAppendingPathComponent:selectedfile].UTF8String; } }