summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-16 19:31:14 -0700
committerGitHub <noreply@github.com>2022-08-16 19:31:14 -0700
commitcbc7e62f42bc0770fbd9da20ed39a5191778e2af (patch)
tree2a9f5598aed1757cf4736dbed69056bc5160fc3d /source
parent42f49937ffa69c82e333e886952eed027e12340e (diff)
Compute canonical path for modules loaded from source. (#2365)
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang.cpp12
1 files changed, 11 insertions, 1 deletions
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,