More work on aqhome-react service.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <gwenhywfar/debug.h>
|
||||
#include <gwenhywfar/i18n.h>
|
||||
#include <gwenhywfar/stringlist.h>
|
||||
#include <gwenhywfar/directory.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -41,6 +42,7 @@ static void _initI18n(void);
|
||||
static void _definePath(const char *pathName, const char *pathValue);
|
||||
static GWEN_STRINGLIST *_getListOfMatchingFiles(const char *pathName, const char *subFolder, const char *mask);
|
||||
static GWEN_BUFFER *_getRuntimeFilePath(const char *pathName, const char *sFilename);
|
||||
static GWEN_BUFFER *_findFileinPath(const char *pathName, const char *sFilename);
|
||||
|
||||
|
||||
|
||||
@@ -115,6 +117,20 @@ GWEN_BUFFER *AQH_GetRuntimeFilePath(const char *sFilename)
|
||||
|
||||
|
||||
|
||||
GWEN_BUFFER *AQH_FindPathOfRuntimeFile(const char *sFilename)
|
||||
{
|
||||
return _findFileinPath(AQHOME_PM_RTDATADIR, sFilename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_BUFFER *AQH_FindPathOfSysconfFile(const char *sFilename)
|
||||
{
|
||||
return _findFileinPath(AQHOME_PM_SYSCONFDIR, sFilename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_DB_NODE *AQH_LoadConfigFile(void)
|
||||
{
|
||||
@@ -306,3 +322,24 @@ GWEN_BUFFER *_getRuntimeFilePath(const char *pathName, const char *sFilename)
|
||||
|
||||
|
||||
|
||||
GWEN_BUFFER *_findFileinPath(const char *pathName, const char *sFilename)
|
||||
{
|
||||
GWEN_STRINGLIST *sl;
|
||||
|
||||
sl=GWEN_PathManager_GetPaths(AQHOME_PM_LIBNAME, pathName);
|
||||
if (sl) {
|
||||
int rv;
|
||||
GWEN_BUFFER *buf;
|
||||
|
||||
buf=GWEN_Buffer_new(0, 256, 0, 1);
|
||||
rv=GWEN_Directory_FindFileInPaths(sl, sFilename, buf);
|
||||
GWEN_StringList_free(sl);
|
||||
if (rv==0)
|
||||
return buf;
|
||||
GWEN_Buffer_free(buf);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user