diff options
| author | Yong He <yonghe@outlook.com> | 2022-08-16 19:31:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-16 19:31:14 -0700 |
| commit | cbc7e62f42bc0770fbd9da20ed39a5191778e2af (patch) | |
| tree | 2a9f5598aed1757cf4736dbed69056bc5160fc3d /source | |
| parent | 42f49937ffa69c82e333e886952eed027e12340e (diff) | |
Compute canonical path for modules loaded from source. (#2365)
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang.cpp | 12 |
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, |
