Commit ec364eaa authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Account for include paths mixing '/' and '\'.

Include pathnames are passed unchanged to ID3DInclude objects so e.g. if a file is included as "path/file.h" the full pathname will have mixed slashes.
parent 770eaec5
......@@ -242,7 +242,7 @@ static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_T
const char *filename, const void *parent_data, const void **data, UINT *bytes)
{
const char *p, *parent_name = "";
char *pathname = NULL;
char *pathname = NULL, *ptr;
char **buffer = NULL;
HANDLE file;
UINT size;
......@@ -259,14 +259,23 @@ static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_T
TRACE("Looking up for include file %s, parent %s\n", debugstr_a(filename), debugstr_a(parent_name));
if ((p = strrchr(parent_name, '\\')) || (p = strrchr(parent_name, '/'))) p++;
else p = parent_name;
if ((p = strrchr(parent_name, '\\')))
++p;
else
p = parent_name;
pathname = HeapAlloc(GetProcessHeap(), 0, (p - parent_name) + strlen(filename) + 1);
if(!pathname)
return HRESULT_FROM_WIN32(GetLastError());
memcpy(pathname, parent_name, p - parent_name);
strcpy(pathname + (p - parent_name), filename);
ptr = pathname + (p - parent_name);
while (*ptr)
{
if (*ptr == '/')
*ptr = '\\';
++ptr;
}
file = CreateFileA(pathname, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if(file == INVALID_HANDLE_VALUE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment