Browse Source

Fixed a bug in the Projucer that would incorrectly mark relative SDK paths as invalid even if they were valid

tags/2021-05-28
hogliux 8 years ago
parent
commit
288e56de83
7 changed files with 34 additions and 19 deletions
  1. +1
    -1
      extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp
  2. +2
    -2
      extras/Projucer/Source/Project Saving/jucer_ProjectExport_AndroidBase.h
  3. +3
    -3
      extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp
  4. +14
    -7
      extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.cpp
  5. +8
    -1
      extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.h
  6. +4
    -4
      extras/Projucer/Source/Utility/jucer_StoredSettings.cpp
  7. +2
    -1
      extras/Projucer/Source/Utility/jucer_StoredSettings.h

+ 1
- 1
extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp View File

@@ -60,7 +60,7 @@ void PathSettingsTab::textPropertyComponentChanged (TextPropertyComponent* textP
{
Identifier keyName = getKeyForPropertyComponent (textPropertyComponent);
Colour textColour = getAppSettings().isGlobalPathValid (keyName, textPropertyComponent->getText())
Colour textColour = getAppSettings().isGlobalPathValid (File::getCurrentWorkingDirectory(), keyName, textPropertyComponent->getText())
? Colours::black
: Colours::red;


+ 2
- 2
extras/Projucer/Source/Project Saving/jucer_ProjectExport_AndroidBase.h View File

@@ -129,10 +129,10 @@ public:
props.add (new TextWithDefaultPropertyComponent<String> (androidVersionCode, "Android Version Code", 32),
"An integer value that represents the version of the application code, relative to other versions.");
props.add (new DependencyPathPropertyComponent (sdkPath, "Android SDK Path"),
props.add (new DependencyPathPropertyComponent (project.getFile().getParentDirectory(), sdkPath, "Android SDK Path"),
"The path to the Android SDK folder on the target build machine");
props.add (new DependencyPathPropertyComponent (ndkPath, "Android NDK Path"),
props.add (new DependencyPathPropertyComponent (project.getFile().getParentDirectory(), ndkPath, "Android NDK Path"),
"The path to the Android NDK folder on the target build machine");
props.add (new TextWithDefaultPropertyComponent<String> (androidMinimumSDK, "Minimum SDK version", 32),


+ 3
- 3
extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp View File

@@ -244,19 +244,19 @@ void ProjectExporter::createDependencyPathProperties (PropertyListBuilder& props
{
if (supportsVST3() && (project.shouldBuildVST3().getValue() || project.isVST3PluginHost()))
{
props.add (new DependencyPathPropertyComponent (getVST3PathValue(), "VST3 SDK Folder"),
props.add (new DependencyPathPropertyComponent (project.getFile().getParentDirectory(), getVST3PathValue(), "VST3 SDK Folder"),
"If you're building a VST3 plugin or host, this must be the folder containing the VST3 SDK. This can be an absolute path, or a path relative to the Projucer project file.");
}
if (supportsAAX() && project.shouldBuildAAX().getValue())
{
props.add (new DependencyPathPropertyComponent (getAAXPathValue(), "AAX SDK Folder"),
props.add (new DependencyPathPropertyComponent (project.getFile().getParentDirectory(), getAAXPathValue(), "AAX SDK Folder"),
"If you're building an AAX plugin, this must be the folder containing the AAX SDK. This can be an absolute path, or a path relative to the Projucer project file.");
}
if (supportsRTAS() && project.shouldBuildRTAS().getValue())
{
props.add (new DependencyPathPropertyComponent (getRTASPathValue(), "RTAS SDK Folder"),
props.add (new DependencyPathPropertyComponent (project.getFile().getParentDirectory(), getRTASPathValue(), "RTAS SDK Folder"),
"If you're building an RTAS, this must be the folder containing the RTAS SDK. This can be an absolute path, or a path relative to the Projucer project file.");
}
}


+ 14
- 7
extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.cpp View File

@@ -40,20 +40,27 @@ DependencyPathValueSource::DependencyPathValueSource (const Value& projectSettin
globalSettingsValue.addListener (this);
}
bool DependencyPathValueSource::isValidPath() const
bool DependencyPathValueSource::isValidPath (const File& relativeTo) const
{
// if we are on another OS than the one which this path setting is for,
// we have no way of knowing whether the path is valid - so just assume it is:
if (! appliesToThisOS())
return true;
return getAppSettings().isGlobalPathValid (globalKey, getValue().toString());
return getAppSettings().isGlobalPathValid (relativeTo, globalKey, getValue().toString());
}
bool DependencyPathValueSource::isValidPath() const
{
return isValidPath (File::getCurrentWorkingDirectory());
}
//==============================================================================
DependencyPathPropertyComponent::DependencyPathPropertyComponent (const Value& value,
DependencyPathPropertyComponent::DependencyPathPropertyComponent (const File& pathRelativeToUse,
const Value& value,
const String& propertyName)
try : TextPropertyComponent (propertyName, 1024, false),
pathRelativeTo (pathRelativeToUse),
pathValue (value),
pathValueSource (dynamic_cast<DependencyPathValueSource&> (pathValue.getValueSource()))
{
@@ -100,11 +107,11 @@ void DependencyPathPropertyComponent::textWasEdited()
Colour DependencyPathPropertyComponent::getTextColourToDisplay() const
{
if (! pathValueSource.isUsingProjectSettings())
return pathValueSource.isValidPath() ? Colours::grey
: Colours::lightpink;
return pathValueSource.isValidPath (pathRelativeTo) ? Colours::grey
: Colours::lightpink;
return pathValueSource.isValidPath() ? Colours::black
: Colours::red;
return pathValueSource.isValidPath (pathRelativeTo) ? Colours::black
: Colours::red;
}
void DependencyPathPropertyComponent::labelTextChanged (Label*)


+ 8
- 1
extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.h View File

@@ -82,6 +82,8 @@ public:
return os == TargetOS::getThisOS();
}
bool isValidPath (const File& relativeTo) const;
bool isValidPath() const;
private:
@@ -143,7 +145,8 @@ class DependencyPathPropertyComponent : public TextPropertyComponent,
private Label::Listener
{
public:
DependencyPathPropertyComponent (const Value& value,
DependencyPathPropertyComponent (const File& pathRelativeToUse,
const Value& value,
const String& propertyName);
@@ -158,6 +161,10 @@ private:
/** This function handles path changes because the global path changed. */
void valueChanged (Value& value) override;
/** If the dependency path is relative, relative to which directory should
we check if an object is available. */
File pathRelativeTo;
/** the value that represents this dependency path setting. */
Value pathValue;


+ 4
- 4
extras/Projucer/Source/Utility/jucer_StoredSettings.cpp View File

@@ -218,10 +218,10 @@ void StoredSettings::ColourSelectorWithSwatches::setSwatchColour (int index, con
}
//==============================================================================
static bool doesSDKPathContainFile (const String& path, const String& fileToCheckFor)
static bool doesSDKPathContainFile (const File& relativeTo, const String& path, const String& fileToCheckFor)
{
String actualPath = path.replace ("${user.home}", File::getSpecialLocation (File::userHomeDirectory).getFullPathName());
return File::getCurrentWorkingDirectory().getChildFile (actualPath + "/" + fileToCheckFor).existsAsFile();
return relativeTo.getChildFile (actualPath + "/" + fileToCheckFor).existsAsFile();
}
Value StoredSettings::getGlobalPath (const Identifier& key, DependencyPathOS os)
@@ -271,7 +271,7 @@ String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS
return String();
}
bool StoredSettings::isGlobalPathValid (const Identifier& key, const String& path)
bool StoredSettings::isGlobalPathValid (const File& relativeTo, const Identifier& key, const String& path)
{
String fileToCheckFor;
@@ -310,5 +310,5 @@ bool StoredSettings::isGlobalPathValid (const Identifier& key, const String& pat
return false;
}
return doesSDKPathContainFile (path, fileToCheckFor);
return doesSDKPathContainFile (relativeTo, path, fileToCheckFor);
}

+ 2
- 1
extras/Projucer/Source/Utility/jucer_StoredSettings.h View File

@@ -67,7 +67,8 @@ public:
//==============================================================================
Value getGlobalPath (const Identifier& key, DependencyPathOS);
String getFallbackPath (const Identifier& key, DependencyPathOS);
bool isGlobalPathValid (const Identifier& key, const String& path);
bool isGlobalPathValid (const File& relativeTo, const Identifier& key, const String& path);
private:
OwnedArray<PropertiesFile> propertyFiles;


Loading…
Cancel
Save