diff options
Diffstat (limited to 'source/slang/slang-core-module.cpp')
| -rw-r--r-- | source/slang/slang-core-module.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source/slang/slang-core-module.cpp b/source/slang/slang-core-module.cpp index 5b163e594..df53bbf42 100644 --- a/source/slang/slang-core-module.cpp +++ b/source/slang/slang-core-module.cpp @@ -1,6 +1,6 @@ +#include "../core/slang-string-util.h" #include "slang-compiler.h" #include "slang-ir.h" -#include "../core/slang-string-util.h" #define STRINGIZE(x) STRINGIZE2(x) #define STRINGIZE2(x) #x @@ -8,18 +8,19 @@ namespace Slang { - String Session::getCoreModulePath() +String Session::getCoreModulePath() +{ + if (coreModulePath.getLength() == 0) { - if(coreModulePath.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 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 - coreModulePath = Path::getFileName(lines[0]); - } - return coreModulePath; + // Make the path just the filename to remove issues around path being included on different + // targets + coreModulePath = Path::getFileName(lines[0]); } + return coreModulePath; } +} // namespace Slang |
