From 255fd5873f65a6b01d5385c277d55612dc3cc587 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 28 Mar 2022 22:14:33 -0700 Subject: Allow slangc to generate exe from .slang file. (#2170) --- tools/slang-embed/slang-embed.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools/slang-embed/slang-embed.cpp') diff --git a/tools/slang-embed/slang-embed.cpp b/tools/slang-embed/slang-embed.cpp index 4a81c1b95..7fb865eee 100644 --- a/tools/slang-embed/slang-embed.cpp +++ b/tools/slang-embed/slang-embed.cpp @@ -18,7 +18,7 @@ #include "../../source/core/slang-string.h" #include "../../source/core/slang-string-util.h" #include "../../source/core/slang-io.h" - +#include "../../source/core/slang-dictionary.h" // Utility to free pointers on scope exit struct ScopedMemory @@ -59,6 +59,7 @@ struct App { char const* appName = "slang-embed"; char const* inputPath = nullptr; + Slang::HashSet includedFiles; void parseOptions(int argc, char** argv) { @@ -89,6 +90,13 @@ struct App { using namespace Slang; + String canonicalPath; + if (SLANG_SUCCEEDED(Slang::Path::getCanonical(inputPath, canonicalPath))) + { + if (!includedFiles.Add(canonicalPath)) + return; + } + // We open the input file in text mode because we are currently // embedding textual source files. If/when this utility gets // used for binary files another mode could be called for. -- cgit v1.2.3