----------------------------------------------------------------------------- perform a modification on the specified file. allowed modifications are specified in the enum above.
| 323 | // perform a modification on the specified file. allowed modifications are |
| 324 | // specified in the enum above. |
| 325 | bool ModifyFile(const char * name, S32 modType) |
| 326 | { |
| 327 | if(!name || (dStrlen(name) >= MaxPath) || dStrstr(name, "../") != NULL) |
| 328 | return(false); |
| 329 | |
| 330 | // if its absolute skip it |
| 331 | if (name[0]=='/' || name[0]=='\\') |
| 332 | return(false); |
| 333 | |
| 334 | // only modify files in home directory |
| 335 | char prefPathName[MaxPath]; |
| 336 | MungePath(prefPathName, MaxPath, name, GetPrefDir()); |
| 337 | |
| 338 | if (modType == TOUCH) |
| 339 | return(utime(prefPathName, 0) != -1); |
| 340 | else if (modType == DELETE) |
| 341 | return (remove(prefPathName) == 0); |
| 342 | else |
| 343 | AssertFatal(false, "Unknown File Mod type"); |
| 344 | return false; |
| 345 | } |
| 346 | |
| 347 | //----------------------------------------------------------------------------- |
| 348 | static bool RecurseDumpPath(const char *path, const char* relativePath, const char *pattern, Vector<Platform::FileInfo> &fileVector, S32 currentDepth = 0, S32 recurseDepth = -1) |
no test coverage detected