--------------------------------------
| 703 | |
| 704 | //-------------------------------------- |
| 705 | bool 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 |
nothing calls this directly
no test coverage detected