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

Method createPath

Engine/source/platformPOSIX/POSIXFileio.cpp:880–906  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

878
879//-----------------------------------------------------------------------------
880bool Platform::createPath(const char *file)
881{
882 char pathbuf[MaxPath];
883 const char *dir;
884 pathbuf[0] = 0;
885 U32 pathLen = 0;
886
887 // all paths should be created in home directory
888 char prefPathName[MaxPath];
889 MungePath(prefPathName, MaxPath, file, GetPrefDir());
890 file = prefPathName;
891
892 // does the directory exist already?
893 if (DirExists(prefPathName, true)) // true means that the path is a filepath
894 return true;
895
896 while((dir = dStrchr(file, '/')) != NULL)
897 {
898 dStrncpy(pathbuf + pathLen, file, dir - file);
899 pathbuf[pathLen + dir-file] = 0;
900 bool ret = mkdir(pathbuf, 0700);
901 pathLen += dir - file;
902 pathbuf[pathLen++] = '/';
903 file = dir + 1;
904 }
905 return true;
906}
907
908// JMQ: Platform:cdFileExists in unimplemented
909//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

MungePathFunction · 0.85
GetPrefDirFunction · 0.85
DirExistsFunction · 0.85
dStrncpyFunction · 0.85
dStrchrFunction · 0.50

Tested by

no test coverage detected