Browse Source

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

master
kevin 11 years ago
parent
commit
2f42661b40
1 changed files with 14 additions and 3 deletions
  1. 14
    3
      cmFileSys.c

+ 14
- 3
cmFileSys.c View File

@@ -32,6 +32,7 @@ typedef struct
32 32
   const cmChar_t* appNameStr;
33 33
 #ifdef OS_OSX
34 34
   _cmFsOsx_t* p;
35
+  cmChar_t* prefDir;
35 36
 #endif
36 37
 #ifdef OS_LINUX
37 38
   _cmFsLinux_t* p;
@@ -117,12 +118,25 @@ cmFsRC_t cmFileSysInitialize( cmFileSysH_t* hp, cmCtx_t* ctx, const cmChar_t* ap
117 118
     goto errLabel;
118 119
   }
119 120
 
121
+  p->appNameStr =  cmLhAllocStr(p->heapH,appNameStr);
122
+
123
+  hp->h = p;
124
+
120 125
 #ifdef OS_OSX
121 126
   if( (rc = _cmOsxFileSysInit(&p->p, p->heapH, &p->err)) != kOkFsRC )
122 127
   {
123 128
     rc = _cmFileSysError(p,kOsxFailFsRC,0,"OSX file system initialization failed.");
124 129
     goto errLabel;
125 130
   }
131
+
132
+  const cmChar_t* dir = cmFsMakeFn(p->p->prefDir,appNameStr,NULL,NULL);
133
+
134
+  // BUG?
135
+  // we reuse p->p->prefDir here because the one returned by the platform
136
+  // specific code is never released  ... which isn't quite right either
137
+  // See osx/cmFileSysOsx.c.
138
+  p->p->prefDir = cmLhAllocStr(p->heapH,dir);
139
+  cmFsFreeFn(dir);
126 140
 #endif
127 141
 
128 142
 #ifdef OS_LINUX
@@ -135,9 +149,6 @@ cmFsRC_t cmFileSysInitialize( cmFileSysH_t* hp, cmCtx_t* ctx, const cmChar_t* ap
135 149
   {
136 150
 #endif
137 151
 
138
-  p->appNameStr =  cmLhAllocStr(p->heapH,appNameStr);
139
-
140
-  hp->h = p;
141 152
 
142 153
 #ifdef OS_LINUX
143 154
 

Loading…
Cancel
Save