API: Add a preferred plugin settings path
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9054
This commit is contained in:
@@ -115,10 +115,7 @@ API_PLUGIN_CONFIG::API_PLUGIN_CONFIG( API_PLUGIN& aParent, const wxFileName& aCo
|
||||
return;
|
||||
}
|
||||
|
||||
// At minimum, we need a reverse-DNS style identifier with two dots and a 2+ character TLD
|
||||
wxRegEx identifierRegex( wxS( "[\\w\\d]{2,}\\.[\\w\\d]+\\.[\\w\\d]+" ) );
|
||||
|
||||
if( !identifierRegex.Matches( identifier ) )
|
||||
if( !API_PLUGIN::IsValidIdentifier( identifier ) )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Plugin: identifier %s does not meet requirements",
|
||||
identifier ) );
|
||||
@@ -172,6 +169,14 @@ bool API_PLUGIN::IsOk() const
|
||||
}
|
||||
|
||||
|
||||
bool API_PLUGIN::IsValidIdentifier( const wxString& aIdentifier )
|
||||
{
|
||||
// At minimum, we need a reverse-DNS style identifier with two dots and a 2+ character TLD
|
||||
wxRegEx identifierRegex( wxS( "[\\w\\d]{2,}\\.[\\w\\d]+\\.[\\w\\d]+" ) );
|
||||
return identifierRegex.Matches( aIdentifier );
|
||||
}
|
||||
|
||||
|
||||
const wxString& API_PLUGIN::Identifier() const
|
||||
{
|
||||
return m_config->identifier;
|
||||
|
||||
Reference in New Issue
Block a user