Skip to content

Commit

Permalink
Add configuration placeholder %%ldcversion%%
Browse files Browse the repository at this point in the history
  • Loading branch information
d-musique authored and thewilsonator committed Jan 5, 2025
1 parent eef3229 commit f6298a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# LDC master

#### Big news
- ldc2.conf: `%%ldcversion%%` placeholder added, allowing to refer to version-specific directories.

#### Platform support

Expand Down
9 changes: 8 additions & 1 deletion driver/configfile.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f6298a5

Please sign in to comment.