The iOS game list screen now also displays folders that contain main.lua.

This commit is contained in:
Alex Szpakowski
2015-08-15 23:57:04 -03:00
parent e44f20fdc6
commit 9a1c4ad565
6 changed files with 23 additions and 10 deletions
+16 -3
View File
@@ -130,9 +130,22 @@ static NSString *getDocumentsDirectory()
static NSArray *getLovesInDocuments()
{
NSString *documents = getDocumentsDirectory();
NSArray *filepaths = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:documents error:nil];
return [filepaths pathsMatchingExtensions:@[@"love"]];
NSMutableArray *paths = [NSMutableArray new];
NSFileManager *manager = [NSFileManager defaultManager];
NSDirectoryEnumerator *enumerator = [manager enumeratorAtPath:getDocumentsDirectory()];
NSString *path = nil;
while ((path = [enumerator nextObject]))
{
// Add .love files plus folders that contain main.lua to our list.
if ([path.pathExtension isEqualToString:@"love"])
[paths addObject:path];
else if ([path.lastPathComponent isEqualToString:@"main.lua"])
[paths addObject:path.stringByDeletingLastPathComponent];
}
return paths;
}
static bool deleteFileInDocuments(NSString *filename)
+2 -2
View File
@@ -29,7 +29,7 @@
namespace love
{
namespace osx
namespace macosx
{
/**
@@ -55,7 +55,7 @@ std::string getExecutablePath();
**/
void requestAttention(bool continuous);
} // osx
} // macosx
} // love
#endif // LOVE_MACOSX
+1 -1
View File
@@ -29,7 +29,7 @@
namespace love
{
namespace osx
namespace macosx
{
std::string getLoveInResources()