ReactOS  0.4.13-dev-482-ge57f103
splitpath.c File Reference
#include "winefile.h"
Include dependency graph for splitpath.c:

Go to the source code of this file.

Functions

void _wsplitpath (const WCHAR *path, WCHAR *drv, WCHAR *dir, WCHAR *name, WCHAR *ext)
 

Function Documentation

◆ _wsplitpath()

void _wsplitpath ( const WCHAR path,
WCHAR drv,
WCHAR dir,
WCHAR name,
WCHAR ext 
)

Definition at line 22 of file splitpath.c.

23 {
24  const WCHAR* end; /* end of processed string */
25  const WCHAR* p; /* search pointer */
26  const WCHAR* s; /* copy pointer */
27 
28  /* extract drive name */
29  if (path[0] && path[1]==':') {
30  if (drv) {
31  *drv++ = *path++;
32  *drv++ = *path++;
33  *drv = '\0';
34  }
35  } else if (drv)
36  *drv = '\0';
37 
38  /* Don't parse colons as stream separators when splitting paths */
39  end = path + lstrlenW(path);
40 
41  /* search for begin of file extension */
42  for(p=end; p>path && *--p!='\\' && *p!='/'; )
43  if (*p == '.') {
44  end = p;
45  break;
46  }
47 
48  if (ext)
49  for(s=end; (*ext=*s++); )
50  ext++;
51 
52  /* search for end of directory name */
53  for(p=end; p>path; )
54  if (*--p=='\\' || *p=='/') {
55  p++;
56  break;
57  }
58 
59  if (name) {
60  for(s=p; s<end; )
61  *name++ = *s++;
62 
63  *name = '\0';
64  }
65 
66  if (dir) {
67  for(s=path; s<p; )
68  *dir++ = *s++;
69 
70  *dir = '\0';
71  }
72 }
GLsizei const GLchar ** path
Definition: glext.h:7234
GLuint GLuint end
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:407
char ext[3]
Definition: mkdosfs.c:358
unsigned int dir
Definition: maze.c:112
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLdouble s
Definition: gl.h:2039
Definition: services.c:325
Definition: name.c:36
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by activate_drive_window(), alloc_child_window(), ExplorerCmd::EvaluateOption(), FrameWndProc(), GetSystemDrive(), InstallScreenSaverW(), prompt_target(), refresh_child(), show_frame(), and XCOPY_ProcessDestParm().