freerdp - fix iOS directory paths

This commit is contained in:
Richard Markiewicz 2017-10-06 14:55:34 -07:00 committed by Marc-André Moreau
parent 8871d55589
commit ee7b5460b5
3 changed files with 27 additions and 6 deletions

View File

@ -117,7 +117,7 @@ static char* GetPath_XDG_DATA_HOME(void)
{
size_t size;
char* path = NULL;
#if defined(WIN32)
#if defined(WIN32) || defined(__IOS__)
path = GetPath_XDG_CONFIG_HOME();
#else
char* home = NULL;
@ -170,7 +170,7 @@ static char* GetPath_XDG_CONFIG_HOME(void)
}
#elif defined(__IOS__)
path = GetCombinedPath(GetPath_HOME(), ".freerdp");
path = ios_get_data();
#else
char* home = NULL;
/**
@ -226,6 +226,8 @@ static char* GetPath_XDG_CACHE_HOME(void)
}
free(home);
#elif defined(__IOS__)
path = ios_get_cache();
#else
/**
* There is a single base directory relative to which user-specific non-essential (cached) data should be written.

View File

@ -3,6 +3,8 @@
char* ios_get_home(void);
char* ios_get_temp(void);
char* ios_get_data(void);
char* ios_get_cache(void);
#endif

View File

@ -26,15 +26,32 @@
#include "shell_ios.h"
NSString* ios_get_directory_for_search_path(NSString* searchPath)
{
return [NSSearchPathForDirectoriesInDomains(searchPath,
NSUserDomainMask, YES) lastObject];
}
char* ios_get_home(void)
{
NSString* home_path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES) lastObject];
return strdup([home_path UTF8String]);
NSString* path = ios_get_directory_for_search_path(NSDocumentDirectory);
return strdup([path UTF8String]);
}
char* ios_get_temp(void)
{
NSString* tmp_path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"freerdp"];
NSString* tmp_path = NSTemporaryDirectory();
return strdup([tmp_path UTF8String]);
}
char* ios_get_data(void)
{
NSString* path = ios_get_directory_for_search_path(NSApplicationSupportDirectory);
return strdup([path UTF8String]);
}
char* ios_get_cache(void)
{
NSString* path = ios_get_directory_for_search_path(NSCachesDirectory);
return strdup([path UTF8String]);
}