MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / ModifyFile

Function ModifyFile

engine/source/platformEmscripten/EmscriptenFileio.cpp:315–335  ·  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

313// perform a modification on the specified file. allowed modifications are
314// specified in the enum above.
315bool ModifyFile(const char * name, S32 modType)
316{
317 if(!name || (dStrlen(name) >= MAX_PATH) || dStrstr(name, "../") != NULL)
318 return(false);
319
320 // if its absolute skip it
321 if (name[0]=='/' || name[0]=='\\')
322 return(false);
323
324 // only modify files in home directory
325 char prefPathName[MaxPath];
326 MungePath(prefPathName, MaxPath, name, GetPrefDir());
327
328 if (modType == TOUCH)
329 return(utime(prefPathName, 0) != -1);
330 else if (modType == DELETE)
331 return (remove(prefPathName) != -1);
332 else
333 AssertFatal(false, "Unknown File Mod type");
334 return false;
335}
336
337//-----------------------------------------------------------------------------
338static bool RecurseDumpPath(const char *path, const char* relativePath, const char *pattern, Vector<Platform::FileInfo> &fileVector, int recurseDepth)

Callers 2

fileDeleteMethod · 0.70
dFileTouchFunction · 0.70

Calls 5

removeFunction · 0.85
dStrlenFunction · 0.70
dStrstrFunction · 0.70
MungePathFunction · 0.70
GetPrefDirFunction · 0.70

Tested by

no test coverage detected