summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-core-module.cpp
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-10-25 15:59:17 -0700
committerGitHub <noreply@github.com>2024-10-25 15:59:17 -0700
commitd8969d87dcc9eea3f186a0c93c5e48d3d1659e05 (patch)
treea7c17a8d8ce08bdd1551ba4815de809a4d1783f6 /source/slang/slang-core-module.cpp
parent4bad669bbc5ec3ff77321f083c59cde87eb10229 (diff)
Replace stdlib with core-module on files and projects (#5411)
This commit renames the files and projects to prefer "core-module" over "stdlib". The directory name `source/slang-stdlib` needs to be renamed too, and there will be another commit for it soon.
Diffstat (limited to 'source/slang/slang-core-module.cpp')
-rw-r--r--source/slang/slang-core-module.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/slang-core-module.cpp b/source/slang/slang-core-module.cpp
new file mode 100644
index 000000000..8867ba1c3
--- /dev/null
+++ b/source/slang/slang-core-module.cpp
@@ -0,0 +1,25 @@
+#include "slang-compiler.h"
+#include "slang-ir.h"
+#include "../core/slang-string-util.h"
+
+#define STRINGIZE(x) STRINGIZE2(x)
+#define STRINGIZE2(x) #x
+#define LINE_STRING STRINGIZE(__LINE__)
+
+namespace Slang
+{
+ String Session::getStdlibPath()
+ {
+ if(stdlibPath.getLength() == 0)
+ {
+ // Make sure we have a line of text from __FILE__, that we'll extract the filename from
+ List<UnownedStringSlice> lines;
+ StringUtil::calcLines(UnownedStringSlice::fromLiteral(__FILE__), lines);
+ SLANG_ASSERT(lines.getCount() > 0 && lines[0].getLength() > 0);
+
+ // Make the path just the filename to remove issues around path being included on different targets
+ stdlibPath = Path::getFileName(lines[0]);
+ }
+ return stdlibPath;
+ }
+}