cmFileSys.h/c Added cmFileSysAppName().

This commit is contained in:
kevin 2012-12-03 17:08:22 -08:00
parent 36430c0d0a
commit 5fe66b872a
2 changed files with 14 additions and 0 deletions

View File

@ -29,6 +29,7 @@ typedef struct
{ {
cmErr_t err; cmErr_t err;
cmLHeapH_t heapH; cmLHeapH_t heapH;
const cmChar_t* appNameStr;
#ifdef OS_OSX #ifdef OS_OSX
_cmFsOsx_t* p; _cmFsOsx_t* p;
#endif #endif
@ -134,6 +135,8 @@ cmFsRC_t cmFileSysInitialize( cmFileSysH_t* hp, cmCtx_t* ctx, const cmChar_t* ap
{ {
#endif #endif
p->appNameStr = cmLhAllocStr(p->heapH,appNameStr);
hp->h = p; hp->h = p;
#ifdef OS_LINUX #ifdef OS_LINUX
@ -174,6 +177,12 @@ cmFsRC_t cmFileSysFinalize( cmFileSysH_t* hp )
return rc; return rc;
} }
const cmChar_t* cmFileSysAppName( cmFileSysH_t h )
{
cmFs_t* p = _cmFileSysHandleToPtr(h);
return p->appNameStr;
}
const cmChar_t* cmFileSysPrefsDir( cmFileSysH_t h ) const cmChar_t* cmFileSysPrefsDir( cmFileSysH_t h )
{ {
cmFs_t* p = _cmFileSysHandleToPtr(h); cmFs_t* p = _cmFileSysHandleToPtr(h);
@ -1011,6 +1020,9 @@ cmFsRC_t cmFsInitialize( cmCtx_t* ctx, const cmChar_t* appNameStr )
cmFsRC_t cmFsFinalize() cmFsRC_t cmFsFinalize()
{ return cmFileSysFinalize(&_cmFsH); } { return cmFileSysFinalize(&_cmFsH); }
const cmChar_t* cmFsAppName()
{ return cmFileSysAppName(_cmFsH); }
const cmChar_t* cmFsPrefsDir() const cmChar_t* cmFsPrefsDir()
{ return cmFileSysPrefsDir(_cmFsH); } { return cmFileSysPrefsDir(_cmFsH); }

View File

@ -59,6 +59,7 @@ extern "C" {
// Returns true if the file system handle is active and initialized. // Returns true if the file system handle is active and initialized.
bool cmFileSysIsValid( cmFileSysH_t h ); 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* 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* 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. 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 cmFsInitialize( cmCtx_t* ctx, const cmChar_t* appNameStr );
cmFsRC_t cmFsFinalize(); cmFsRC_t cmFsFinalize();
const cmChar_t* cmFsAppName();
const cmChar_t* cmFsPrefsDir(); const cmChar_t* cmFsPrefsDir();
const cmChar_t* cmFsRsrcDir(); const cmChar_t* cmFsRsrcDir();
const cmChar_t* cmFsUserDir(); const cmChar_t* cmFsUserDir();