/// <summary>
/// Searches for a folder config that has the same type and key, and updates
/// its other fields with provided value, if found; creates new folder config otherwise.
/// </summary>
public void UpdateFolder(RainbowFolder match, RainbowFolder value)
{
Undo.RecordObject(this, "Modify Rainbow Folder Settings");
RainbowFolder existingFolder = GetFolder(match);
if (existingFolder != null)
{
if (value.HasAtLeastOneIcon())
{
existingFolder.CopyFrom(value);
}
else
{
RemoveAll(match);
}
}
else
{
if (value.HasAtLeastOneIcon())
{
AddFolder(value);
}
}
EditorUtility.SetDirty(this);
}