2007-03-14 20:24:57 +00:00
|
|
|
/*
|
2008-12-13 21:06:47 +00:00
|
|
|
* PROJECT: ReactOS CRT library
|
|
|
|
* LICENSE: See COPYING in the top level directory
|
|
|
|
* FILE: lib/sdk/crt/stdlib/wmakpath.c
|
|
|
|
* PURPOSE: Creates a unicode path
|
|
|
|
* PROGRAMMERS: Wine team
|
|
|
|
* Copyright 1996,1998 Marcus Meissner
|
|
|
|
* Copyright 1996 Jukka Iivonen
|
|
|
|
* Copyright 1997,2000 Uwe Bonnes
|
|
|
|
* Copyright 2000 Jon Griffiths
|
|
|
|
*
|
2007-03-14 20:24:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
void _wmakepath(wchar_t* path, const wchar_t* drive, const wchar_t* dir, const wchar_t* fname, const wchar_t* ext)
|
|
|
|
{
|
2008-12-13 21:06:47 +00:00
|
|
|
wchar_t *p = path;
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2008-12-13 21:06:47 +00:00
|
|
|
if ( !path )
|
|
|
|
return;
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2008-12-13 21:06:47 +00:00
|
|
|
if (drive && drive[0])
|
|
|
|
{
|
|
|
|
*p++ = drive[0];
|
|
|
|
*p++ = ':';
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|
2008-12-13 21:06:47 +00:00
|
|
|
if (dir && dir[0])
|
|
|
|
{
|
2011-09-15 17:11:53 +00:00
|
|
|
size_t len = strlenW(dir);
|
2008-12-13 21:06:47 +00:00
|
|
|
memmove(p, dir, len * sizeof(wchar_t));
|
|
|
|
p += len;
|
|
|
|
if (p[-1] != '/' && p[-1] != '\\')
|
|
|
|
*p++ = '\\';
|
|
|
|
}
|
|
|
|
if (fname && fname[0])
|
|
|
|
{
|
2011-09-15 17:11:53 +00:00
|
|
|
size_t len = strlenW(fname);
|
2008-12-13 21:06:47 +00:00
|
|
|
memmove(p, fname, len * sizeof(wchar_t));
|
|
|
|
p += len;
|
|
|
|
}
|
|
|
|
if (ext && ext[0])
|
|
|
|
{
|
|
|
|
if (ext[0] != '.')
|
|
|
|
*p++ = '.';
|
|
|
|
strcpyW(p, ext);
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|
2008-12-13 21:06:47 +00:00
|
|
|
else
|
|
|
|
*p = '\0';
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|