MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / ModifyFile

Function ModifyFile

Engine/source/platformPOSIX/POSIXFileio.cpp:325–345  ·  view source on GitHub ↗

----------------------------------------------------------------------------- perform a modification on the specified file. allowed modifications are specified in the enum above.

Source from the content-addressed store, hash-verified

323// perform a modification on the specified file. allowed modifications are
324// specified in the enum above.
325bool 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//-----------------------------------------------------------------------------
348static bool RecurseDumpPath(const char *path, const char* relativePath, const char *pattern, Vector<Platform::FileInfo> &fileVector, S32 currentDepth = 0, S32 recurseDepth = -1)

Callers 3

dFileDeleteFunction · 0.85
dFileTouchFunction · 0.85
fileDeleteMethod · 0.85

Calls 4

dStrstrFunction · 0.85
MungePathFunction · 0.85
GetPrefDirFunction · 0.85
dStrlenFunction · 0.50

Tested by

no test coverage detected