summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-24 10:57:20 -0700
committerGitHub <noreply@github.com>2022-08-24 10:57:20 -0700
commit14d99e80c47a0daac6ef76b5d68511c828147265 (patch)
tree91db1e70c4ebc4104a9a8e5ef53103db334ac44a /source
parentd245c72f2a92a74ccda83f41758c1948ae5132d3 (diff)
Disable module name translation when it ends with ".slang" (#2377)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 461d15df5..6101a5298 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -2867,17 +2867,24 @@ RefPtr<Module> Linkage::findOrImportModule(
//
// For example, `foo_bar` becomes `foo-bar.slang`.
- StringBuilder sb;
- for (auto c : getText(name))
+ String fileName;
+ if (!getText(name).getUnownedSlice().endsWithCaseInsensitive(".slang"))
{
- if (c == '_')
- c = '-';
+ StringBuilder sb;
+ for (auto c : getText(name))
+ {
+ if (c == '_')
+ c = '-';
- sb.Append(c);
+ sb.Append(c);
+ }
+ sb.Append(".slang");
+ fileName = sb.ProduceString();
+ }
+ else
+ {
+ fileName = getText(name);
}
- sb.Append(".slang");
-
- String fileName = sb.ProduceString();
// Next, try to find the file of the given name,
// using our ordinary include-handling logic.