cmFileSys.c:OSX pref. directory now uses 'appNameStr' as preference folder.

This commit is contained in:
kevin 2013-05-01 14:58:12 -07:00
parent c26679e567
commit 2f42661b40

View File

@ -32,6 +32,7 @@ typedef struct
const cmChar_t* appNameStr; const cmChar_t* appNameStr;
#ifdef OS_OSX #ifdef OS_OSX
_cmFsOsx_t* p; _cmFsOsx_t* p;
cmChar_t* prefDir;
#endif #endif
#ifdef OS_LINUX #ifdef OS_LINUX
_cmFsLinux_t* p; _cmFsLinux_t* p;
@ -117,12 +118,25 @@ cmFsRC_t cmFileSysInitialize( cmFileSysH_t* hp, cmCtx_t* ctx, const cmChar_t* ap
goto errLabel; goto errLabel;
} }
p->appNameStr = cmLhAllocStr(p->heapH,appNameStr);
hp->h = p;
#ifdef OS_OSX #ifdef OS_OSX
if( (rc = _cmOsxFileSysInit(&p->p, p->heapH, &p->err)) != kOkFsRC ) if( (rc = _cmOsxFileSysInit(&p->p, p->heapH, &p->err)) != kOkFsRC )
{ {
rc = _cmFileSysError(p,kOsxFailFsRC,0,"OSX file system initialization failed."); rc = _cmFileSysError(p,kOsxFailFsRC,0,"OSX file system initialization failed.");
goto errLabel; goto errLabel;
} }
const cmChar_t* dir = cmFsMakeFn(p->p->prefDir,appNameStr,NULL,NULL);
// BUG?
// we reuse p->p->prefDir here because the one returned by the platform
// specific code is never released ... which isn't quite right either
// See osx/cmFileSysOsx.c.
p->p->prefDir = cmLhAllocStr(p->heapH,dir);
cmFsFreeFn(dir);
#endif #endif
#ifdef OS_LINUX #ifdef OS_LINUX
@ -135,9 +149,6 @@ cmFsRC_t cmFileSysInitialize( cmFileSysH_t* hp, cmCtx_t* ctx, const cmChar_t* ap
{ {
#endif #endif
p->appNameStr = cmLhAllocStr(p->heapH,appNameStr);
hp->h = p;
#ifdef OS_LINUX #ifdef OS_LINUX