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

Method createPath

Engine/source/platformWin32/winFileio.cpp:705–736  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

703
704//--------------------------------------
705bool Platform::createPath(const char *file)
706{
707 TempAlloc< TCHAR > pathbuf( dStrlen( file ) + 1 );
708
709#ifdef UNICODE
710 TempAlloc< WCHAR > fileBuf( pathbuf.size );
711 convertUTF8toUTF16N( file, fileBuf, fileBuf.size );
712 const WCHAR* fileName = fileBuf;
713 const WCHAR* dir;
714#else
715 const char* fileName = file;
716 const char* dir;
717#endif
718
719 pathbuf[ 0 ] = 0;
720 U32 pathLen = 0;
721
722 while((dir = dStrchr(fileName, '/')) != NULL)
723 {
724 TCHAR* pathptr = pathbuf;
725 dMemcpy( pathptr + pathLen, fileName, ( dir - fileName ) * sizeof( TCHAR ) );
726 pathbuf[pathLen + dir-fileName] = 0;
727
728 // ignore return value because we are fine with already existing directory
729 CreateDirectory(pathbuf, NULL);
730
731 pathLen += dir - fileName;
732 pathbuf[pathLen++] = '\\';
733 fileName = dir + 1;
734 }
735 return true;
736}
737
738// [rene, 04/05/2008] Not used currently so did not bother updating.
739#if 0

Callers

nothing calls this directly

Calls 5

convertUTF8toUTF16NFunction · 0.85
CreateDirectoryFunction · 0.85
dMemcpyFunction · 0.70
dStrlenFunction · 0.50
dStrchrFunction · 0.50

Tested by

no test coverage detected