diff --git a/cmFileSys.c b/cmFileSys.c index eca4dfa..ebca145 100644 --- a/cmFileSys.c +++ b/cmFileSys.c @@ -29,6 +29,7 @@ typedef struct { cmErr_t err; cmLHeapH_t heapH; + const cmChar_t* appNameStr; #ifdef OS_OSX _cmFsOsx_t* p; #endif @@ -134,6 +135,8 @@ cmFsRC_t cmFileSysInitialize( cmFileSysH_t* hp, cmCtx_t* ctx, const cmChar_t* ap { #endif + p->appNameStr = cmLhAllocStr(p->heapH,appNameStr); + hp->h = p; #ifdef OS_LINUX @@ -174,6 +177,12 @@ cmFsRC_t cmFileSysFinalize( cmFileSysH_t* hp ) return rc; } +const cmChar_t* cmFileSysAppName( cmFileSysH_t h ) +{ + cmFs_t* p = _cmFileSysHandleToPtr(h); + return p->appNameStr; +} + const cmChar_t* cmFileSysPrefsDir( cmFileSysH_t h ) { cmFs_t* p = _cmFileSysHandleToPtr(h); @@ -1011,6 +1020,9 @@ cmFsRC_t cmFsInitialize( cmCtx_t* ctx, const cmChar_t* appNameStr ) cmFsRC_t cmFsFinalize() { return cmFileSysFinalize(&_cmFsH); } +const cmChar_t* cmFsAppName() +{ return cmFileSysAppName(_cmFsH); } + const cmChar_t* cmFsPrefsDir() { return cmFileSysPrefsDir(_cmFsH); } diff --git a/cmFileSys.h b/cmFileSys.h index 23f672b..0dddca3 100644 --- a/cmFileSys.h +++ b/cmFileSys.h @@ -59,6 +59,7 @@ extern "C" { // Returns true if the file system handle is active and initialized. bool cmFileSysIsValid( cmFileSysH_t h ); + const cmChar_t* cmFileSysAppName( cmFileSysH_t h ); //< Return the application name as passed to cmFileSysInitialize() const cmChar_t* cmFileSysPrefsDir( cmFileSysH_t h ); //< Return the operating system dependent preference data directory for this application. const cmChar_t* cmFileSysRsrcDir( cmFileSysH_t h ); //< Return the operating system dependent application resource directory for this application. const cmChar_t* cmFileSysUserDir( cmFileSysH_t h ); //< Return the operating system dependent user directory for this application. @@ -187,6 +188,7 @@ extern "C" { cmFsRC_t cmFsInitialize( cmCtx_t* ctx, const cmChar_t* appNameStr ); cmFsRC_t cmFsFinalize(); + const cmChar_t* cmFsAppName(); const cmChar_t* cmFsPrefsDir(); const cmChar_t* cmFsRsrcDir(); const cmChar_t* cmFsUserDir();