From 2f42661b40b8efcb678c7671c0733178d444cd6f Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 1 May 2013 14:58:12 -0700 Subject: [PATCH] cmFileSys.c:OSX pref. directory now uses 'appNameStr' as preference folder. --- cmFileSys.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cmFileSys.c b/cmFileSys.c index 0fb29ca..9cd8147 100644 --- a/cmFileSys.c +++ b/cmFileSys.c @@ -32,6 +32,7 @@ typedef struct const cmChar_t* appNameStr; #ifdef OS_OSX _cmFsOsx_t* p; + cmChar_t* prefDir; #endif #ifdef OS_LINUX _cmFsLinux_t* p; @@ -117,12 +118,25 @@ cmFsRC_t cmFileSysInitialize( cmFileSysH_t* hp, cmCtx_t* ctx, const cmChar_t* ap goto errLabel; } + p->appNameStr = cmLhAllocStr(p->heapH,appNameStr); + + hp->h = p; + #ifdef OS_OSX if( (rc = _cmOsxFileSysInit(&p->p, p->heapH, &p->err)) != kOkFsRC ) { rc = _cmFileSysError(p,kOsxFailFsRC,0,"OSX file system initialization failed."); 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 #ifdef OS_LINUX @@ -135,9 +149,6 @@ 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