1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Escape special characters in MSVC project files

This commit is contained in:
reuk 2021-08-17 13:59:07 +01:00
parent 23e621f26e
commit 5f7ad995af
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -25,6 +25,14 @@
#pragma once
inline String msBuildEscape (String str)
{
// see https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-special-characters?view=vs-2019
for (const auto& special : { "%", "$", "@", "'", ";", "?", "\""})
str = str.replace (special, "%" + String::toHexString (*special));
return str;
}
//==============================================================================
class MSVCProjectExporterBase : public ProjectExporter
@ -502,7 +510,7 @@ public:
{
auto* targetName = props->createNewChildElement ("TargetName");
setConditionAttribute (*targetName, config);
targetName->addTextElement (config.getOutputFilename ("", false, type == UnityPlugIn));
targetName->addTextElement (msBuildEscape (config.getOutputFilename ("", false, type == UnityPlugIn)));
}
{
@ -597,7 +605,7 @@ public:
auto externalLibraries = getExternalLibraries (config, getOwner().getExternalLibrariesString());
auto additionalDependencies = type != SharedCodeTarget && externalLibraries.isNotEmpty()
? getOwner().replacePreprocessorTokens (config, externalLibraries).trim() + ";%(AdditionalDependencies)"
? msBuildEscape (getOwner().replacePreprocessorTokens (config, externalLibraries).trim()) + ";%(AdditionalDependencies)"
: String();
auto librarySearchPaths = config.getLibrarySearchPaths();