From 2700a89f8c80620f1d523563cc80ec0da39e9761 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 22 Oct 2018 20:48:59 -0400 Subject: Fix problem with __import not working (#688) * Added getPathType to ISlangFileSystemExt. This is needed so that when searching for a file it's existance can be tested without loading the file. On some platforms a getCanonicalPath can do this - but depending on how getCanonicalPath is implemented, it may not do. This test is made after the relative path is produced before finding the canonical path. * Test for importing along search path. * Added comment to explain the issue around WrapFileSystem impl of getPathType. * Make search path use / not \ --- source/slang/slang.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 5461afbf7..996f8e32f 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -118,6 +118,13 @@ struct IncludeHandlerImpl : IncludeHandler return SLANG_FAIL; } + SlangPathType pathType; + SLANG_RETURN_ON_FAIL(fileSystemExt->getPathType(relPath.begin(), &pathType)); + if (pathType != SLANG_PATH_TYPE_FILE) + { + return SLANG_E_NOT_FOUND; + } + // Get the canonical path ComPtr canonicalPathBlob; SLANG_RETURN_ON_FAIL(fileSystemExt->getCanoncialPath(relPath.begin(), canonicalPathBlob.writeRef())); -- cgit v1.2.3