summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-11-25 21:57:48 -0500
committerGitHub <noreply@github.com>2024-11-25 21:57:48 -0500
commite6cf93e3e638cb981a9be392a2f48ea06acd4e3f (patch)
treec1eda91f26dae8b1a60ac00ca12d90d4c67ad8a9 /tools
parentd282701ba76e9883d2b7be39ee614fe3bb4f5165 (diff)
Fix issue with slang-embed & include ordering (#5680)
* Fix issue with slang-embed & include ordering * Update CMakeLists.txt
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-embed/slang-embed.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/slang-embed/slang-embed.cpp b/tools/slang-embed/slang-embed.cpp
index eb493be4b..8cba887f3 100644
--- a/tools/slang-embed/slang-embed.cpp
+++ b/tools/slang-embed/slang-embed.cpp
@@ -63,6 +63,7 @@ struct App
{
char const* appName = "slang-embed";
char const* inputPath = nullptr;
+ char const* includeDir = nullptr;
char const* outputPath = nullptr;
Slang::HashSet<Slang::String> includedFiles;
@@ -85,13 +86,19 @@ struct App
if (argc > 0)
{
+ includeDir = *argv++;
+ argc--;
+ }
+
+ if (argc > 0)
+ {
outputPath = *argv++;
argc--;
}
if (!inputPath || (argc != 0))
{
- fprintf(stderr, "usage: %s inputPath [outputPath]\n", appName);
+ fprintf(stderr, "usage: %s inputPath includeDir [outputPath]\n", appName);
exit(1);
}
}
@@ -137,7 +144,13 @@ struct App
auto path =
Slang::Path::combine(Slang::Path::getParentDirectory(inputPath), fileName);
if (!Slang::File::exists(path))
- goto normalProcess;
+ {
+ // Try looking in the include directory.
+ path = Slang::Path::combine(includeDir, fileName);
+
+ if (!Slang::File::exists(path))
+ goto normalProcess;
+ }
processInputFile(outputFile, path.getUnownedSlice());
continue;
}