mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-23 01:44:22 +00:00
Projucer: Escape single quotes in project names for makefile projects
This commit is contained in:
parent
cd495f136e
commit
6c775a367b
3 changed files with 21 additions and 15 deletions
|
|
@ -197,7 +197,7 @@ public:
|
|||
|
||||
if (type == VST3PlugIn)
|
||||
{
|
||||
s.add ("JUCE_VST3DIR := " + escapeSpaces (targetName).upToLastOccurrenceOf (".", false, false) + ".vst3");
|
||||
s.add ("JUCE_VST3DIR := " + escapeQuotesAndSpaces (targetName).upToLastOccurrenceOf (".", false, false) + ".vst3");
|
||||
s.add ("VST3_PLATFORM_ARCH := $(shell $(CXX) make_helpers/arch_detection.cpp 2>&1 | tr '\\n' ' ' | sed \"s/.*JUCE_ARCH \\([a-zA-Z0-9_-]*\\).*/\\1/\")");
|
||||
s.add ("JUCE_VST3SUBDIR := Contents/$(VST3_PLATFORM_ARCH)-linux");
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ public:
|
|||
targetName = "$(JUCE_UNITYDIR)/" + targetName;
|
||||
}
|
||||
|
||||
s.add ("JUCE_TARGET_" + getTargetVarName() + String (" := ") + escapeSpaces (targetName));
|
||||
s.add ("JUCE_TARGET_" + getTargetVarName() + String (" := ") + escapeQuotesAndSpaces (targetName));
|
||||
|
||||
if (config.isPluginBinaryCopyStepEnabled() && (type == VST3PlugIn || type == VSTPlugIn || type == UnityPlugIn))
|
||||
{
|
||||
|
|
@ -223,7 +223,7 @@ public:
|
|||
else if (type == VSTPlugIn)
|
||||
{
|
||||
s.add ("JUCE_VSTDESTDIR := " + config.getVSTBinaryLocationString());
|
||||
s.add (copyCmd + escapeSpaces (targetName) + " $(JUCE_VSTDESTDIR)");
|
||||
s.add (copyCmd + escapeQuotesAndSpaces (targetName) + " $(JUCE_VSTDESTDIR)");
|
||||
}
|
||||
else if (type == UnityPlugIn)
|
||||
{
|
||||
|
|
@ -256,7 +256,7 @@ public:
|
|||
out << "OBJECTS_" + getTargetVarName() + String (" := \\") << newLine;
|
||||
|
||||
for (auto& f : filesToCompile)
|
||||
out << " $(JUCE_OBJDIR)/" << escapeSpaces (owner.getObjectFileFor ({ f.first, owner.getTargetFolder(), build_tools::RelativePath::buildTargetFolder }))
|
||||
out << " $(JUCE_OBJDIR)/" << escapeQuotesAndSpaces (owner.getObjectFileFor ({ f.first, owner.getTargetFolder(), build_tools::RelativePath::buildTargetFolder }))
|
||||
<< " \\" << newLine;
|
||||
|
||||
out << newLine;
|
||||
|
|
@ -271,7 +271,7 @@ public:
|
|||
{
|
||||
build_tools::RelativePath relativePath (f.first, owner.getTargetFolder(), build_tools::RelativePath::buildTargetFolder);
|
||||
|
||||
out << "$(JUCE_OBJDIR)/" << escapeSpaces (owner.getObjectFileFor (relativePath)) << ": " << escapeSpaces (relativePath.toUnixStyle()) << newLine
|
||||
out << "$(JUCE_OBJDIR)/" << escapeQuotesAndSpaces (owner.getObjectFileFor (relativePath)) << ": " << escapeQuotesAndSpaces (relativePath.toUnixStyle()) << newLine
|
||||
<< "\t-$(V_AT)mkdir -p $(JUCE_OBJDIR)" << newLine
|
||||
<< "\t@echo \"Compiling " << relativePath.getFileName() << "\"" << newLine
|
||||
<< (relativePath.hasFileExtension ("c;s;S") ? "\t$(V_AT)$(CC) $(JUCE_CFLAGS) " : "\t$(V_AT)$(CXX) $(JUCE_CXXFLAGS) ")
|
||||
|
|
@ -711,7 +711,7 @@ private:
|
|||
void writeHeaderPathFlags (OutputStream& out, const BuildConfiguration& config) const
|
||||
{
|
||||
for (auto& path : getHeaderSearchPaths (config))
|
||||
out << " -I" << escapeSpaces (path).replace ("~", "$(HOME)");
|
||||
out << " -I" << escapeQuotesAndSpaces (path).replace ("~", "$(HOME)");
|
||||
}
|
||||
|
||||
void writeCppFlags (OutputStream& out, const MakeBuildConfiguration& config) const
|
||||
|
|
@ -729,7 +729,7 @@ private:
|
|||
out << " JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR)";
|
||||
|
||||
for (auto path : getLibrarySearchPaths (config))
|
||||
out << " -L" << escapeSpaces (path).replace ("~", "$(HOME)");
|
||||
out << " -L" << escapeQuotesAndSpaces (path).replace ("~", "$(HOME)");
|
||||
|
||||
auto pkgConfigFlags = getLinkerPkgConfigFlags();
|
||||
|
||||
|
|
@ -802,11 +802,11 @@ private:
|
|||
outputDir = binaryPath.rebased (projectFolder, getTargetFolder(), build_tools::RelativePath::buildTargetFolder).toUnixStyle();
|
||||
}
|
||||
|
||||
out << "ifeq ($(CONFIG)," << escapeSpaces (config.getName()) << ")" << newLine
|
||||
<< " JUCE_BINDIR := " << escapeSpaces (buildDirName) << newLine
|
||||
<< " JUCE_LIBDIR := " << escapeSpaces (buildDirName) << newLine
|
||||
<< " JUCE_OBJDIR := " << escapeSpaces (intermediatesDirName) << newLine
|
||||
<< " JUCE_OUTDIR := " << escapeSpaces (outputDir) << newLine
|
||||
out << "ifeq ($(CONFIG)," << escapeQuotesAndSpaces (config.getName()) << ")" << newLine
|
||||
<< " JUCE_BINDIR := " << escapeQuotesAndSpaces (buildDirName) << newLine
|
||||
<< " JUCE_LIBDIR := " << escapeQuotesAndSpaces (buildDirName) << newLine
|
||||
<< " JUCE_OBJDIR := " << escapeQuotesAndSpaces (intermediatesDirName) << newLine
|
||||
<< " JUCE_OUTDIR := " << escapeQuotesAndSpaces (outputDir) << newLine
|
||||
<< newLine
|
||||
<< " ifeq ($(TARGET_ARCH),)" << newLine
|
||||
<< " TARGET_ARCH := " << getArchFlags (config) << newLine
|
||||
|
|
@ -944,9 +944,9 @@ private:
|
|||
<< "endif" << newLine
|
||||
<< newLine;
|
||||
|
||||
out << "ifndef CONFIG" << newLine
|
||||
<< " CONFIG=" << escapeSpaces (getConfiguration(0)->getName()) << newLine
|
||||
<< "endif" << newLine
|
||||
out << "ifndef CONFIG" << newLine
|
||||
<< " CONFIG=" << escapeQuotesAndSpaces (getConfiguration(0)->getName()) << newLine
|
||||
<< "endif" << newLine
|
||||
<< newLine;
|
||||
|
||||
out << "JUCE_ARCH_LABEL := $(shell uname -m)" << newLine
|
||||
|
|
|
|||
|
|
@ -99,6 +99,11 @@ String escapeSpaces (const String& s)
|
|||
return s.replace (" ", "\\ ");
|
||||
}
|
||||
|
||||
String escapeQuotesAndSpaces (const String& s)
|
||||
{
|
||||
return escapeSpaces (s).replace ("'", "\\'").replace ("\"", "\\\"");
|
||||
}
|
||||
|
||||
String addQuotesIfContainsSpaces (const String& text)
|
||||
{
|
||||
return (text.containsChar (' ') && ! text.isQuotedString()) ? text.quoted() : text;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ String createAlphaNumericUID();
|
|||
String createGUID (const String& seed); // Turns a seed into a windows GUID
|
||||
|
||||
String escapeSpaces (const String& text); // replaces spaces with blackslash-space
|
||||
String escapeQuotesAndSpaces (const String& text);
|
||||
String addQuotesIfContainsSpaces (const String& text);
|
||||
|
||||
StringPairArray parsePreprocessorDefs (const String& defs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue