1 #include <msvcrt/stdlib.h>
2 #include <msvcrt/string.h>
5 void _wsplitpath(const wchar_t* path, wchar_t* drive, wchar_t* dir, wchar_t* fname, wchar_t* ext)
11 tmp_drive = (wchar_t*)wcschr(path,L':');
12 if ( tmp_drive != (wchar_t*)NULL ) {
13 wcsncpy(drive,tmp_drive-1,1);
18 tmp_drive = (wchar_t*)path;
21 tmp_dir = (wchar_t*)wcsrchr(path,L'\\');
22 if( tmp_dir != NULL && tmp_dir != tmp_drive + 1 ) {
23 wcsncpy(dir,tmp_drive+1,tmp_dir - tmp_drive);
24 *(dir + (tmp_dir - tmp_drive)) = 0;
29 tmp_ext = (wchar_t*)wcsrchr(path,L'.');
30 if ( tmp_ext != NULL ) {
36 tmp_ext = (wchar_t*)path+wcslen(path);
39 if ( tmp_dir != NULL ) {
40 wcsncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
41 *(fname + (tmp_ext - tmp_dir -1)) = 0;
45 wcsncpy(fname,path,tmp_ext - path);
46 *(fname+(tmp_ext-path))=0;