mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
iOS: Fix compile errors
This commit is contained in:
+11
-5
@@ -21,6 +21,8 @@
|
|||||||
#include "ios.h"
|
#include "ios.h"
|
||||||
#include "apple.h"
|
#include "apple.h"
|
||||||
|
|
||||||
|
using namespace love::apple;
|
||||||
|
|
||||||
#ifdef LOVE_IOS
|
#ifdef LOVE_IOS
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
@@ -130,10 +132,12 @@ static bool deleteFileInDocuments(NSString *filename);
|
|||||||
|
|
||||||
static NSArray *getLovesInDocuments()
|
static NSArray *getLovesInDocuments()
|
||||||
{
|
{
|
||||||
|
std::string docdir = getUserDirectory(USER_DIRECTORY_DOCUMENTS);
|
||||||
|
|
||||||
NSMutableArray *paths = [NSMutableArray new];
|
NSMutableArray *paths = [NSMutableArray new];
|
||||||
|
|
||||||
NSFileManager *manager = [NSFileManager defaultManager];
|
NSFileManager *manager = [NSFileManager defaultManager];
|
||||||
NSDirectoryEnumerator *enumerator = [manager enumeratorAtPath:getDocumentsDirectory()];
|
NSDirectoryEnumerator *enumerator = [manager enumeratorAtPath:@(docdir.c_str())];
|
||||||
|
|
||||||
NSString *path = nil;
|
NSString *path = nil;
|
||||||
while ((path = [enumerator nextObject]))
|
while ((path = [enumerator nextObject]))
|
||||||
@@ -150,9 +154,9 @@ static NSArray *getLovesInDocuments()
|
|||||||
|
|
||||||
static bool deleteFileInDocuments(NSString *filename)
|
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];
|
bool success = [[NSFileManager defaultManager] removeItemAtPath:file error:nil];
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -173,7 +177,8 @@ static int dropFileEventFilter(void *userdata, SDL_Event *event)
|
|||||||
|
|
||||||
if ([fmanager fileExistsAtPath:fname] && [fname.pathExtension isEqual:@"love"])
|
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;
|
documents = documents.stringByStandardizingPath.stringByResolvingSymlinksInPath;
|
||||||
fname = fname.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.
|
// The string length might be 0 if the no-game screen was selected.
|
||||||
if (selectedfile != nil && selectedfile.length > 0)
|
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;
|
path = [documents stringByAppendingPathComponent:selectedfile].UTF8String;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user