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() static NSArray *getLovesInDocuments()
{ {
NSString *documents = getDocumentsDirectory(); NSMutableArray *paths = [NSMutableArray new];
NSArray *filepaths = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:documents error:nil];
return [filepaths pathsMatchingExtensions:@[@"love"]]; 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) static bool deleteFileInDocuments(NSString *filename)
+2 -2
View File
@@ -29,7 +29,7 @@
namespace love namespace love
{ {
namespace osx namespace macosx
{ {
/** /**
@@ -55,7 +55,7 @@ std::string getExecutablePath();
**/ **/
void requestAttention(bool continuous); void requestAttention(bool continuous);
} // osx } // macosx
} // love } // love
#endif // LOVE_MACOSX #endif // LOVE_MACOSX
+1 -1
View File
@@ -29,7 +29,7 @@
namespace love namespace love
{ {
namespace osx namespace macosx
{ {
std::string getLoveInResources() std::string getLoveInResources()
+2 -2
View File
@@ -111,7 +111,7 @@ static void get_app_arguments(int argc, char **argv, int &new_argc, char **&new_
#ifdef LOVE_MACOSX #ifdef LOVE_MACOSX
// Check for a drop file string. // Check for a drop file string.
std::string dropfilestr = love::osx::checkDropEvents(); std::string dropfilestr = love::macosx::checkDropEvents();
if (!dropfilestr.empty()) if (!dropfilestr.empty())
{ {
temp_argv.insert(temp_argv.begin() + 1, dropfilestr); temp_argv.insert(temp_argv.begin() + 1, dropfilestr);
@@ -123,7 +123,7 @@ static void get_app_arguments(int argc, char **argv, int &new_argc, char **&new_
std::string loveResourcesPath; std::string loveResourcesPath;
bool fused = true; bool fused = true;
#if defined(LOVE_MACOSX) #if defined(LOVE_MACOSX)
loveResourcesPath = love::osx::getLoveInResources(); loveResourcesPath = love::macosx::getLoveInResources();
#elif defined(LOVE_IOS) #elif defined(LOVE_IOS)
loveResourcesPath = love::ios::getLoveInResources(fused); loveResourcesPath = love::ios::getLoveInResources(fused);
#endif #endif
+1 -1
View File
@@ -74,7 +74,7 @@ bool Filesystem::isRealDirectory(const std::string &path) const
std::string Filesystem::getExecutablePath() const std::string Filesystem::getExecutablePath() const
{ {
#if defined(LOVE_MACOSX) #if defined(LOVE_MACOSX)
return love::osx::getExecutablePath(); return love::macosx::getExecutablePath();
#elif defined(LOVE_IOS) #elif defined(LOVE_IOS)
return love::ios::getExecutablePath(); return love::ios::getExecutablePath();
#elif defined(LOVE_WINDOWS) #elif defined(LOVE_WINDOWS)
+1 -1
View File
@@ -1031,7 +1031,7 @@ void Window::requestAttention(bool continuous)
#elif defined(LOVE_MACOSX) #elif defined(LOVE_MACOSX)
love::osx::requestAttention(continuous); love::macosx::requestAttention(continuous);
#else #else