iOS: Fix compile errors

This commit is contained in:
Alex Szpakowski
2021-06-06 12:19:54 -03:00
parent 47a9cb9cd5
commit 3d32f1c7d0
+11 -5
View File
@@ -21,6 +21,8 @@
#include "ios.h"
#include "apple.h"
using namespace love::apple;
#ifdef LOVE_IOS
#import <Foundation/Foundation.h>
@@ -130,10 +132,12 @@ static bool deleteFileInDocuments(NSString *filename);
static NSArray *getLovesInDocuments()
{
std::string docdir = getUserDirectory(USER_DIRECTORY_DOCUMENTS);
NSMutableArray *paths = [NSMutableArray new];
NSFileManager *manager = [NSFileManager defaultManager];
NSDirectoryEnumerator *enumerator = [manager enumeratorAtPath:getDocumentsDirectory()];
NSDirectoryEnumerator *enumerator = [manager enumeratorAtPath:@(docdir.c_str())];
NSString *path = nil;
while ((path = [enumerator nextObject]))
@@ -150,9 +154,9 @@ static NSArray *getLovesInDocuments()
static bool deleteFileInDocuments(NSString *filename)
{
NSString *documents = getDocumentsDirectory();
std::string docdir = getUserDirectory(USER_DIRECTORY_DOCUMENTS);
NSString *file = [documents stringByAppendingPathComponent:filename];
NSString *file = [@(docdir.c_str()) stringByAppendingPathComponent:filename];
bool success = [[NSFileManager defaultManager] removeItemAtPath:file error:nil];
if (success)
@@ -173,7 +177,8 @@ static int dropFileEventFilter(void *userdata, SDL_Event *event)
if ([fmanager fileExistsAtPath:fname] && [fname.pathExtension isEqual:@"love"])
{
NSString *documents = getDocumentsDirectory();
std::string docdir = getUserDirectory(USER_DIRECTORY_DOCUMENTS);
NSString *documents = @(docdir.c_str());
documents = documents.stringByStandardizingPath.stringByResolvingSymlinksInPath;
fname = fname.stringByStandardizingPath.stringByResolvingSymlinksInPath;
@@ -326,7 +331,8 @@ std::string getLoveInResources(bool &fused)
// The string length might be 0 if the no-game screen was selected.
if (selectedfile != nil && selectedfile.length > 0)
{
NSString *documents = getDocumentsDirectory();
std::string docdir = getUserDirectory(USER_DIRECTORY_DOCUMENTS);
NSString *documents = @(docdir.c_str());
path = [documents stringByAppendingPathComponent:selectedfile].UTF8String;
}
}