mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
The iOS game list screen now also displays folders that contain main.lua.
This commit is contained in:
+16
-3
@@ -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
@@ -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
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace osx
|
||||
namespace macosx
|
||||
{
|
||||
|
||||
std::string getLoveInResources()
|
||||
|
||||
Reference in New Issue
Block a user