|
@@ -148,35 +148,38 @@ static bool deleteFileInDocuments(NSString *filename)
|
|
|
|
|
|
static int dropFileEventFilter(void *userdata, SDL_Event *event)
|
|
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();
|
|
|
|
+
|
|
|
|
+ documents = documents.stringByStandardizingPath.stringByResolvingSymlinksInPath;
|
|
|
|
+ fname = fname.stringByStandardizingPath.stringByResolvingSymlinksInPath;
|
|
|
|
|
|
- // Update the game list.
|
|
|
|
- NSArray *games = getLovesInDocuments();
|
|
|
|
- vc.gameList = [[NSMutableArray alloc] initWithArray:games copyItems:YES];
|
|
|
|
- [vc.tableView reloadData];
|
|
|
|
|
|
+ // Is the file inside the Documents directory?
|
|
|
|
+ if ([fname hasPrefix:documents])
|
|
|
|
+ {
|
|
|
|
+ LOVETableViewController *vc = (__bridge LOVETableViewController *) userdata;
|
|
|
|
|
|
- SDL_free(event->drop.file);
|
|
|
|
- return 0;
|
|
|
|
|
|
+ // 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
|
|
namespace love
|
|
@@ -245,7 +248,6 @@ std::string getLoveInResources(bool &fused)
|
|
{
|
|
{
|
|
// The game should be fused if we have something here.
|
|
// The game should be fused if we have something here.
|
|
fused = true;
|
|
fused = true;
|
|
- NSLog(@".love files in main Bundle: %@", bundlepaths);
|
|
|
|
return [bundlepaths[0] UTF8String];
|
|
return [bundlepaths[0] UTF8String];
|
|
}
|
|
}
|
|
|
|
|
|
@@ -253,9 +255,6 @@ std::string getLoveInResources(bool &fused)
|
|
// fused.
|
|
// fused.
|
|
NSArray *filepaths = getLovesInDocuments();
|
|
NSArray *filepaths = getLovesInDocuments();
|
|
|
|
|
|
- if (filepaths.count > 0)
|
|
|
|
- NSLog(@".love files in Documents: %@", filepaths);
|
|
|
|
-
|
|
|
|
// Let the user select a game from the un-fused list.
|
|
// Let the user select a game from the un-fused list.
|
|
NSString *selectedfile = showGameList(filepaths);
|
|
NSString *selectedfile = showGameList(filepaths);
|
|
|
|
|
|
@@ -263,8 +262,7 @@ std::string getLoveInResources(bool &fused)
|
|
if (selectedfile != nil && selectedfile.length > 0)
|
|
if (selectedfile != nil && selectedfile.length > 0)
|
|
{
|
|
{
|
|
NSString *documents = getDocumentsDirectory();
|
|
NSString *documents = getDocumentsDirectory();
|
|
- path = [[documents stringByAppendingPathComponent:selectedfile] UTF8String];
|
|
|
|
- NSLog(@"Using unfused .love file: %@", selectedfile);
|
|
|
|
|
|
+ path = [documents stringByAppendingPathComponent:selectedfile].UTF8String;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|