From f6298a53a249da5c207f2e5a50798241512c9cc4 Mon Sep 17 00:00:00 2001 From: "D.musique" Date: Fri, 3 Jan 2025 02:28:44 +0100 Subject: [PATCH] Add configuration placeholder %%ldcversion%% --- CHANGELOG.md | 1 + driver/configfile.d | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 446fdea0f6..e504a75d4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # LDC master #### Big news +- ldc2.conf: `%%ldcversion%%` placeholder added, allowing to refer to version-specific directories. #### Platform support diff --git a/driver/configfile.d b/driver/configfile.d index 4d0b648d06..fa9b090e91 100644 --- a/driver/configfile.d +++ b/driver/configfile.d @@ -110,11 +110,18 @@ struct CfgPaths } } +extern(C++, "ldc") +{ + extern __gshared const(const(char) *) ldc_version; +} + string replacePlaceholders(string str, CfgPaths cfgPaths) { + const dVersion = ldc_version[0..strlen(ldc_version)]; return str .replace("%%ldcbinarypath%%", cfgPaths.ldcBinaryDir) - .replace("%%ldcconfigpath%%", cfgPaths.cfgBaseDir); + .replace("%%ldcconfigpath%%", cfgPaths.cfgBaseDir) + .replace("%%ldcversion%%", cast(string) dVersion); } extern(C++) struct ConfigFile