[6/8] scrrun: Implement IFileSystem3 FolderExists

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Mar 27 04:42:56 CDT 2012


Hi,


Changelog:
     scrrun: Implement IFileSystem3 FolderExists


Best Regards
  Alistair Leslie-Hughes
-------------- next part --------------
>From af2a375e17482c32964d38c0ce0820b2e44d093b Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Tue, 27 Mar 2012 08:47:32 +1100
Subject: [PATCH] Implement IFileSystem3 FolderExists
To: wine-patches <wine-patches at winehq.org>

---
 dlls/scrrun/filesystem.c       |    9 +++++++--
 dlls/scrrun/tests/filesystem.c |   20 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 98496c0..68cbc9f 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -267,9 +267,14 @@ static HRESULT WINAPI filesys_FolderExists(IFileSystem3 *iface, BSTR FolderSpec,
 {
     FileSystem *This = impl_from_IFileSystem3(iface);
 
-    FIXME("%p %s %p\n", This, debugstr_w(FolderSpec), pfExists);
+    TRACE("%p %s %p\n", This, debugstr_w(FolderSpec), pfExists);
 
-    return E_NOTIMPL;
+    if(!pfExists)
+        return E_POINTER;
+
+    *pfExists = PathIsDirectoryW(FolderSpec) ? VARIANT_TRUE : VARIANT_FALSE;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI filesys_GetDrive(IFileSystem3 *iface, BSTR DriveSpec,
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index f97bcb6..21351c8 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -69,6 +69,10 @@ void test_exists(void)
     static const WCHAR existing_fileW[] = {
         'c', ':', '\\', 'W', 'i', 'n', 'd', 'o', 'w', 's', '\\', 's', 'y', 's', 't', 'e', 'm', '3',
         '2', '\\', 'n', 't', 'd', 'l', 'l', '.', 'd', 'l', 'l', 0};
+    static const WCHAR nonexistent_dirW[] = {
+        'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', 0};
+    static const WCHAR existing_dirW[] = {
+        'c', ':', '\\', 'W', 'i', 'n', 'd', 'o', 'w', 's', 0};
 
     hr = CoCreateInstance(&CLSID_FileSystemObject, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
             &IID_IDispatch, (void**)&disp);
@@ -96,6 +100,22 @@ void test_exists(void)
     ok(exists == VARIANT_FALSE, "File exists\n");
     SysFreeString(str);
 
+    /* Folder Exists */
+    hr = IFileSystem3_FolderExists(fs3, NULL, NULL);
+    ok(hr == E_POINTER, "got 0x%08x, expected 0x%08x\n", hr, E_POINTER);
+
+    str = SysAllocString(existing_dirW);
+    hr = IFileSystem3_FolderExists(fs3, str, &exists);
+    ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
+    ok(exists == VARIANT_TRUE, "Folder doesn't exists\n");
+    SysFreeString(str);
+
+    str = SysAllocString(nonexistent_dirW);
+    hr = IFileSystem3_FolderExists(fs3, str, &exists);
+    ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
+    ok(exists == VARIANT_FALSE, "Folder exists\n");
+    SysFreeString(str);
+
     IFileSystem3_Release(fs3);
     IDispatch_Release(disp);
 }
-- 
1.7.5.4



More information about the wine-patches mailing list