Browse Source

Projucer: Escape special characters in MSVC project files

v6.1.6
reuk 4 years ago
parent
commit
5f7ad995af
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h

+ 10
- 2
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h 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();


Loading…
Cancel
Save