Commit 50fe9b87 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

scrrun: Correct FileExists for directories.

parent 3d845b12
......@@ -215,11 +215,13 @@ static HRESULT WINAPI filesys_DriveExists(IFileSystem3 *iface, BSTR DriveSpec,
static HRESULT WINAPI filesys_FileExists(IFileSystem3 *iface, BSTR path, VARIANT_BOOL *ret)
{
DWORD attrs;
TRACE("%p %s %p\n", iface, debugstr_w(path), ret);
if (!ret) return E_POINTER;
*ret = GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES ? VARIANT_TRUE : VARIANT_FALSE;
attrs = GetFileAttributesW(path);
*ret = attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
......
......@@ -82,6 +82,20 @@ static void test_interfaces(void)
ok(b == VARIANT_FALSE, "got %x\n", b);
SysFreeString(path);
path = SysAllocString(file_path);
b = VARIANT_FALSE;
hr = IFileSystem3_FileExists(fs3, path, &b);
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
ok(b == VARIANT_TRUE, "got %x\n", b);
SysFreeString(path);
path = SysAllocString(windows_path);
b = VARIANT_TRUE;
hr = IFileSystem3_FileExists(fs3, path, &b);
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
ok(b == VARIANT_FALSE, "got %x\n", b);
SysFreeString(path);
/* Folder Exists */
hr = IFileSystem3_FolderExists(fs3, NULL, NULL);
ok(hr == E_POINTER, "got 0x%08x, expected 0x%08x\n", hr, E_POINTER);
......
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