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

49
src/Win/ProgramPath.cpp Normal file
View File

@@ -0,0 +1,49 @@
#include<hgl/type/BaseString.h>
#include<windows.h>
#include<shlobj.h>
namespace hgl
{
namespace filesystem
{
void GetLocalAppdataPath(os_char fn[HGL_MAX_PATH])
{
SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, fn);
}
/**
* 取得当前程序完整路径名称
*/
bool GetCurrentProgram(OSString &result)
{
os_char *path=new os_char[HGL_MAX_PATH];
GetModuleFileNameW(nullptr,path,HGL_MAX_PATH);
result = path;
delete[] path;
return(true);
}
/**
* 取得当前程序所在路径
*/
bool GetCurrentProgramPath(OSString &result)
{
os_char *path=new os_char[HGL_MAX_PATH];
int len=GetModuleFileNameW(nullptr,path,HGL_MAX_PATH);
os_char *right=hgl::strrchr(path,len,HGL_DIRECTORY_SEPARATOR);
if(right)
*right=0;
result = path;
delete[] path;
return(true);
}
}//namespace filesystem
}//namespace hgl