|
@@ -248,6 +248,24 @@ bool _cmFileSysIsDir( cmFs_t* p, const cmChar_t* dirStr )
|
248
|
248
|
return S_ISDIR(s.st_mode);
|
249
|
249
|
}
|
250
|
250
|
|
|
251
|
+bool cmFileSysCanWriteToDir( cmFileSysH_t h, const cmChar_t* dirStr )
|
|
252
|
+{
|
|
253
|
+ cmFs_t* p = _cmFileSysHandleToPtr(h);
|
|
254
|
+ int result;
|
|
255
|
+
|
|
256
|
+ errno = 0;
|
|
257
|
+
|
|
258
|
+ if((result = access(dirStr,W_OK)) == 0 )
|
|
259
|
+ return true;
|
|
260
|
+
|
|
261
|
+ if( result == EACCES || result==EROFS )
|
|
262
|
+ return false;
|
|
263
|
+
|
|
264
|
+ _cmFileSysError( p, kAccessFailFsRC, errno, "'access' failed on '%s'.",dirStr);
|
|
265
|
+
|
|
266
|
+ return false;
|
|
267
|
+}
|
|
268
|
+
|
251
|
269
|
bool cmFileSysIsDir( cmFileSysH_t h, const cmChar_t* dirStr )
|
252
|
270
|
{
|
253
|
271
|
cmFs_t* p = _cmFileSysHandleToPtr(h);
|
|
@@ -1129,6 +1147,9 @@ const cmChar_t* cmFsRsrcDir()
|
1129
|
1147
|
const cmChar_t* cmFsUserDir()
|
1130
|
1148
|
{ return cmFileSysUserDir(_cmFsH); }
|
1131
|
1149
|
|
|
1150
|
+bool cmFsCanWriteToDir( const cmChar_t* dirStr )
|
|
1151
|
+{ return cmFileSysCanWriteToDir(_cmFsH,dirStr); }
|
|
1152
|
+
|
1132
|
1153
|
bool cmFsIsDir( const cmChar_t* dirStr )
|
1133
|
1154
|
{ return cmFileSysIsDir(_cmFsH,dirStr); }
|
1134
|
1155
|
|