added GetOSLibararyPath and FindFileOnPaths functions.

This commit is contained in:
2022-03-31 18:13:36 +08:00
parent a4d1ed0c3c
commit 08d2fa2a1f
3 changed files with 82 additions and 1 deletions

View File

@@ -46,6 +46,20 @@ namespace hgl
bool GetCurrentProgramPath(OSString &); ///<取得当前程序所在路径
bool GetLocalAppdataPath(OSString &); ///<取得当前用户应用程序数据存放路径
bool GetOSLibararyPath(OSString &); ///<取得操作系统共用动态库路径
/**
* @param filename 要查找的文件名称
* @param user_data 用户自定义数据
* @param exist 文件是否存在
* @return 是否继续查找
*/
typedef bool (*OnFindedFileFUNC)(const OSString &filename,void *user_data,bool exist);
const uint FindFileOnPaths(const OSString &filename,const OSStringList &paths,void *user_data,OnFindedFileFUNC ff); ///<在多个目录内查找一个文件
const uint FindFileOnPaths(const OSStringList &filenames,const OSStringList &paths,void *user_data,OnFindedFileFUNC ff); ///<在多个目录内查找一个文件,这个文件可能有多个文件名
/**
* 文件名长度限制
*

View File

@@ -79,7 +79,7 @@ namespace hgl
* 根据离散的每一级目录名称和最终名称合成完整文件名
*/
template<typename T>
inline const String<T> ComboFilename(const StringList<String<T>> &sl,const T spear_char=(T)HGL_DIRECTORY_SEPARATOR_RAWCHAR)
inline const String<T> ComboFilename(const StringList<T> &sl,const T spear_char=(T)HGL_DIRECTORY_SEPARATOR_RAWCHAR)
{
T **str_list=AutoDeleteArray<T *>(sl.GetCount());
int *str_len=AutoDeleteArray<int>(sl.GetCount());