Skip to content

Commit cbc7e62

Browse files
authored
Compute canonical path for modules loaded from source. (shader-slang#2365)
1 parent 42f4993 commit cbc7e62

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

source/slang/slang.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -1031,9 +1031,19 @@ SLANG_NO_THROW slang::IModule* SLANG_MCALL Linkage::loadModuleFromSource(
10311031
{
10321032
return loadedModule;
10331033
}
1034+
String pathStr = path;
1035+
auto pathInfo = PathInfo::makeFromString(pathStr);
1036+
if (File::exists(pathStr))
1037+
{
1038+
String cannonicalPath;
1039+
if (SLANG_SUCCEEDED(Path::getCanonical(pathStr, cannonicalPath)))
1040+
{
1041+
pathInfo = PathInfo::makeNormal(pathStr, cannonicalPath);
1042+
}
1043+
}
10341044
auto module = loadModule(
10351045
name,
1036-
PathInfo::makeFromString(path),
1046+
pathInfo,
10371047
source,
10381048
SourceLoc(),
10391049
&sink,

0 commit comments

Comments
 (0)