From cbc7e62f42bc0770fbd9da20ed39a5191778e2af Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 16 Aug 2022 19:31:14 -0700 Subject: Compute canonical path for modules loaded from source. (#2365) --- source/slang/slang.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index b86617f1f..1b8ae0d8f 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -1031,9 +1031,19 @@ SLANG_NO_THROW slang::IModule* SLANG_MCALL Linkage::loadModuleFromSource( { return loadedModule; } + String pathStr = path; + auto pathInfo = PathInfo::makeFromString(pathStr); + if (File::exists(pathStr)) + { + String cannonicalPath; + if (SLANG_SUCCEEDED(Path::getCanonical(pathStr, cannonicalPath))) + { + pathInfo = PathInfo::makeNormal(pathStr, cannonicalPath); + } + } auto module = loadModule( name, - PathInfo::makeFromString(path), + pathInfo, source, SourceLoc(), &sink, -- cgit v1.2.3