更新GetLocalAppdataPath函数,使其风格和其它函数一致
This commit is contained in:
@@ -17,9 +17,10 @@ namespace hgl
|
|||||||
strcpy(files_dir,HGL_MAX_PATH,fn);
|
strcpy(files_dir,HGL_MAX_PATH,fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetLocalAppdataPath(char fn[HGL_MAX_PATH])
|
bool GetLocalAppdataPath(OSString &result)
|
||||||
{
|
{
|
||||||
strcpy(fn,HGL_MAX_PATH,files_dir);
|
result=files_dir;
|
||||||
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -5,13 +5,14 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
namespace filesystem
|
namespace filesystem
|
||||||
{
|
{
|
||||||
void GetLocalAppdataPath(char fn[HGL_MAX_PATH])
|
bool GetLocalAppdataPath(OSString &result)
|
||||||
{
|
{
|
||||||
NSFileManager *dfm=[NSFileManager defaultManager];
|
NSFileManager *dfm=[NSFileManager defaultManager];
|
||||||
|
|
||||||
const char *str=[[[dfm homeDirectoryForCurrentUser] path] cStringUsingEncoding:NSUTF8StringEncoding];
|
const char *str=[[[dfm homeDirectoryForCurrentUser] path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
hgl::strcpy(fn,HGL_MAX_PATH,str,strlen(str));
|
result=str;
|
||||||
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -7,7 +7,7 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
namespace filesystem
|
namespace filesystem
|
||||||
{
|
{
|
||||||
void GetLocalAppdataPath(os_char fn[HGL_MAX_PATH])
|
bool GetLocalAppdataPath(OSString &result)
|
||||||
{
|
{
|
||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
struct passwd *result;
|
struct passwd *result;
|
||||||
@@ -21,9 +21,10 @@ namespace hgl
|
|||||||
|
|
||||||
getpwuid_r(getuid(),&pwd,buf,bufsize,&result);
|
getpwuid_r(getuid(),&pwd,buf,bufsize,&result);
|
||||||
|
|
||||||
strcpy(fn,HGL_MAX_PATH,pwd.pw_dir);
|
result=pwd.pw_dir;
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -6,9 +6,15 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
namespace filesystem
|
namespace filesystem
|
||||||
{
|
{
|
||||||
void GetLocalAppdataPath(os_char fn[HGL_MAX_PATH])
|
bool GetLocalAppdataPath(OSString &result)
|
||||||
{
|
{
|
||||||
SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, fn);
|
os_char fn[HGL_MAX_PATH];
|
||||||
|
|
||||||
|
if(SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, fn)!=S_OK)
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
result=fn;
|
||||||
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user