From 11f77075fa5c718ef176eff28e2d60752834219e Mon Sep 17 00:00:00 2001 From: FreeSlave Date: Fri, 8 Apr 2016 14:17:21 +0300 Subject: [PATCH] Don't show dialog when link to bookmark can't be resolved --- src/dlangui/core/files.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dlangui/core/files.d b/src/dlangui/core/files.d index 13624972..216a950b 100644 --- a/src/dlangui/core/files.d +++ b/src/dlangui/core/files.d @@ -427,7 +427,7 @@ RootEntry[] getBookmarkPaths() nothrow string linksFolder = linksFolderZ[0..wcslen(linksFolderZ)].toUTF8; - CoInitialize(null); + enforce(SUCCEEDED(CoInitialize(null))); scope(exit) CoUninitialize(); HRESULT hres; @@ -435,7 +435,7 @@ RootEntry[] getBookmarkPaths() nothrow auto clsidShellLink = CLSID_ShellLink; auto iidShellLink = IID_IShellLinkW; - hres = CoCreateInstance(&clsidShellLink, null, CLSCTX_INPROC, &iidShellLink, cast(LPVOID*)&psl); + hres = CoCreateInstance(&clsidShellLink, null, CLSCTX.CLSCTX_INPROC_SERVER, &iidShellLink, cast(LPVOID*)&psl); enforce(SUCCEEDED(hres), "Failed to create IShellLink instance"); scope(exit) psl.Release(); @@ -456,7 +456,7 @@ RootEntry[] getBookmarkPaths() nothrow hres = ppf.Load(linkFile.name.toUTF16z, STGM_READ); enforce(SUCCEEDED(hres), "Failed to load link file"); - hres = psl.Resolve(null, 0); + hres = psl.Resolve(null, SLR_FLAGS.SLR_NO_UI); enforce(SUCCEEDED(hres), "Failed to resolve link"); hres = psl.GetPath(szGotPath.ptr, szGotPath.length, &wfd, 0); @@ -464,7 +464,7 @@ RootEntry[] getBookmarkPaths() nothrow auto path = szGotPath[0..wcslen(szGotPath.ptr)]; - if (path.length) { + if (path.length && path.isDir) { res ~= RootEntry(RootEntryType.BOOKMARK, path.toUTF8, linkFile.name.baseName.stripExtension.toUTF32); } } catch(Exception e) {