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

Method createPath

engine/source/platformEmscripten/EmscriptenFileio.cpp:856–882  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

854
855//-----------------------------------------------------------------------------
856bool Platform::createPath(const char *file)
857{
858 char pathbuf[MaxPath];
859 const char *dir;
860 pathbuf[0] = 0;
861 U32 pathLen = 0;
862
863 // all paths should be created in home directory
864 char prefPathName[MaxPath];
865 MungePath(prefPathName, MaxPath, file, GetPrefDir());
866 file = prefPathName;
867
868 // does the directory exist already?
869 if (DirExists(prefPathName, true)) // true means that the path is a filepath
870 return true;
871
872 while((dir = dStrchr(file, '/')) != NULL)
873 {
874 dStrncpy(pathbuf + pathLen, file, dir - file);
875 pathbuf[pathLen + dir-file] = 0;
876 bool ret = mkdir(pathbuf, 0700);
877 pathLen += dir - file;
878 pathbuf[pathLen++] = '/';
879 file = dir + 1;
880 }
881 return true;
882}
883
884// JMQ: Platform:cdFileExists in unimplemented
885//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

MungePathFunction · 0.70
GetPrefDirFunction · 0.70
DirExistsFunction · 0.70
dStrchrFunction · 0.70
dStrncpyFunction · 0.70

Tested by

no test coverage detected