Commit 97b83a6d authored by Robert Wilhelm's avatar Robert Wilhelm Committed by Alexandre Julliard

scrrun: Store full path in folder object.

parent 4e360e8d
...@@ -2699,6 +2699,7 @@ static const IFolderVtbl foldervtbl = { ...@@ -2699,6 +2699,7 @@ static const IFolderVtbl foldervtbl = {
HRESULT create_folder(const WCHAR *path, IFolder **folder) HRESULT create_folder(const WCHAR *path, IFolder **folder)
{ {
struct folder *object; struct folder *object;
DWORD len;
*folder = NULL; *folder = NULL;
...@@ -2709,13 +2710,28 @@ HRESULT create_folder(const WCHAR *path, IFolder **folder) ...@@ -2709,13 +2710,28 @@ HRESULT create_folder(const WCHAR *path, IFolder **folder)
object->IFolder_iface.lpVtbl = &foldervtbl; object->IFolder_iface.lpVtbl = &foldervtbl;
object->ref = 1; object->ref = 1;
object->path = SysAllocString(path);
if (!object->path) len = GetFullPathNameW(path, 0, NULL, NULL);
if (!len)
{
free(object);
return E_FAIL;
}
object->path = SysAllocStringLen(NULL, len);
if(!object->path)
{ {
free(object); free(object);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if (!GetFullPathNameW(path, len, object->path, NULL))
{
SysFreeString(object->path);
free(object);
return E_FAIL;
}
init_classinfo(&CLSID_Folder, (IUnknown *)&object->IFolder_iface, &object->classinfo); init_classinfo(&CLSID_Folder, (IUnknown *)&object->IFolder_iface, &object->classinfo);
*folder = &object->IFolder_iface; *folder = &object->IFolder_iface;
......
...@@ -973,7 +973,7 @@ static void test_GetFolder(void) ...@@ -973,7 +973,7 @@ static void test_GetFolder(void)
SysFreeString(str); SysFreeString(str);
hr = IFolder_get_Path(folder, &str); hr = IFolder_get_Path(folder, &str);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine ok(!PathIsRelativeW(str), "path %s is relative.\n", wine_dbgstr_w(str)); ok(!PathIsRelativeW(str), "path %s is relative.\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
IFolder_Release(folder); IFolder_Release(folder);
RemoveDirectoryW(dir); RemoveDirectoryW(dir);
......
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