first commit

This commit is contained in:
2019-08-23 10:54:57 +08:00
parent 9790a5757c
commit f768bbec4b
65 changed files with 5551 additions and 0 deletions

42
src/Apple/ProgramPath.mm Normal file
View File

@@ -0,0 +1,42 @@
#include<hgl/type/BaseString.h>
#import <Foundation/Foundation.h>
namespace hgl
{
namespace filesystem
{
void GetLocalAppdataPath(char fn[HGL_MAX_PATH])
{
NSFileManager *dfm=[NSFileManager defaultManager];
const char *str=[[[dfm homeDirectoryForCurrentUser] path] cStringUsingEncoding:NSUTF8StringEncoding];
hgl::strcpy(fn,HGL_MAX_PATH,str,strlen(str));
}
/**
* 取得当前程序完整路径名称
*/
bool GetCurrentProgram(UTF8String &result)
{
NSString *ns_string = [[[[NSBundle mainBundle] bundleURL] URLByDeletingPathExtension] path];
result.Set([ns_string cStringUsingEncoding:NSUTF8StringEncoding]);
return(true);
}
/**
* 取得当前程序所在路径
*/
bool GetCurrentProgramPath(UTF8String &result)
{
NSString *ns_string = [[[[NSBundle mainBundle] bundleURL] URLByDeletingLastPathComponent] path];
result.Set([ns_string cStringUsingEncoding:NSUTF8StringEncoding]);
return(true);
}
}//namespace filesystem
}//namespace hgl