mirror of
https://github.com/love2d/love.git
synced 2026-08-21 13:09:56 +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()
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ static void get_app_arguments(int argc, char **argv, int &new_argc, char **&new_
|
||||
|
||||
#ifdef LOVE_MACOSX
|
||||
// Check for a drop file string.
|
||||
std::string dropfilestr = love::osx::checkDropEvents();
|
||||
std::string dropfilestr = love::macosx::checkDropEvents();
|
||||
if (!dropfilestr.empty())
|
||||
{
|
||||
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;
|
||||
bool fused = true;
|
||||
#if defined(LOVE_MACOSX)
|
||||
loveResourcesPath = love::osx::getLoveInResources();
|
||||
loveResourcesPath = love::macosx::getLoveInResources();
|
||||
#elif defined(LOVE_IOS)
|
||||
loveResourcesPath = love::ios::getLoveInResources(fused);
|
||||
#endif
|
||||
|
||||
@@ -74,7 +74,7 @@ bool Filesystem::isRealDirectory(const std::string &path) const
|
||||
std::string Filesystem::getExecutablePath() const
|
||||
{
|
||||
#if defined(LOVE_MACOSX)
|
||||
return love::osx::getExecutablePath();
|
||||
return love::macosx::getExecutablePath();
|
||||
#elif defined(LOVE_IOS)
|
||||
return love::ios::getExecutablePath();
|
||||
#elif defined(LOVE_WINDOWS)
|
||||
|
||||
@@ -1031,7 +1031,7 @@ void Window::requestAttention(bool continuous)
|
||||
|
||||
#elif defined(LOVE_MACOSX)
|
||||
|
||||
love::osx::requestAttention(continuous);
|
||||
love::macosx::requestAttention(continuous);
|
||||
|
||||
#else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user