From 0845912f2706e4fcbe2dea4c467a61c1f8e0a097 Mon Sep 17 00:00:00 2001 From: drpriver Date: Fri, 18 Apr 2025 12:35:39 -0700 Subject: [PATCH] Fix #18263: ImportC fails when DMD is installed in path with spaces (#21263) Fixes https://github.com/dlang/dmd/issues/18263 Command to invoke the preprocessor wasn't quoting paths. This isn't bulletproof and really the interface should be taking an array of strings or use a command-builder type pattern, but this resolves the common issue of paths with spaces in them. --- compiler/src/dmd/link.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dmd/link.d b/compiler/src/dmd/link.d index 750c57cf58..b93b9fd17d 100644 --- a/compiler/src/dmd/link.d +++ b/compiler/src/dmd/link.d @@ -993,7 +993,7 @@ public int runPreprocessor(Loc loc, const(char)[] cpp, const(char)[] filename, c */ OutBuffer buf; buf.writestring(cpp); - buf.printf(" /P /Zc:preprocessor /PD /nologo /utf-8 %.*s /FI%s /Fi%.*s", + buf.printf(" /P /Zc:preprocessor /PD /nologo /utf-8 \"%.*s\" \"/FI%s\" \"/Fi%.*s\"", cast(int)filename.length, filename.ptr, importc_h, cast(int)output.length, output.ptr); /* Append preprocessor switches to command line