Add love.filesystem.mountFullPath.

This commit is contained in:
Alex Szpakowski
2020-10-03 19:28:57 -03:00
parent dcf0968f05
commit 0706b6243c
13 changed files with 494 additions and 208 deletions
+1 -46
View File
@@ -19,6 +19,7 @@
**/
#include "ios.h"
#include "apple.h"
#ifdef LOVE_IOS
@@ -125,12 +126,6 @@ static bool deleteFileInDocuments(NSString *filename);
@end
static NSString *getDocumentsDirectory()
{
NSArray *docdirs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
return docdirs[0];
}
static NSArray *getLovesInDocuments()
{
NSMutableArray *paths = [NSMutableArray new];
@@ -287,38 +282,6 @@ std::string getLoveInResources(bool &fused)
return path;
}
static std::string getUserDirectory(NSSearchPathDirectory dir)
{
std::string path;
@autoreleasepool
{
NSArray<NSURL *> *dirs = [[NSFileManager defaultManager] URLsForDirectory:dir inDomains:NSUserDomainMask];
if (dirs.count > 0)
path = [dirs[0].path UTF8String];
}
return path;
}
std::string getAppdataDirectory()
{
return getUserDirectory(NSApplicationSupportDirectory);
}
std::string getHomeDirectory()
{
std::string path;
@autoreleasepool
{
path = [NSHomeDirectory() UTF8String];
}
return path;
}
bool openURL(const std::string &url)
{
bool success = false;
@@ -335,14 +298,6 @@ bool openURL(const std::string &url)
return success;
}
std::string getExecutablePath()
{
@autoreleasepool
{
return std::string([NSBundle mainBundle].executablePath.UTF8String);
}
}
void vibrate()
{
@autoreleasepool