fix for extracting ident from filename
This commit is contained in:
@@ -79,7 +79,7 @@ public:
|
|||||||
}
|
}
|
||||||
string line;
|
string line;
|
||||||
size_t lastSep = filename.find_last_of('/');
|
size_t lastSep = filename.find_last_of('/');
|
||||||
size_t firstDot = filename.find_first_of('.');
|
size_t firstDot = filename.find_first_of('.', lastSep+1);
|
||||||
string defaultDest = "";
|
string defaultDest = "";
|
||||||
string defaultCircuit = "";
|
string defaultCircuit = "";
|
||||||
if (lastSep!=string::npos && firstDot==lastSep+1+2) { // potential destination address, matches "^ZZ."
|
if (lastSep!=string::npos && firstDot==lastSep+1+2) { // potential destination address, matches "^ZZ."
|
||||||
@@ -89,8 +89,8 @@ public:
|
|||||||
if (result!=RESULT_OK || !isValidAddress(zz))
|
if (result!=RESULT_OK || !isValidAddress(zz))
|
||||||
defaultDest = ""; // invalid: not in hex or no master/slave/broadcast address
|
defaultDest = ""; // invalid: not in hex or no master/slave/broadcast address
|
||||||
else {
|
else {
|
||||||
size_t lastDot = filename.find_last_of('.');
|
size_t lastDot = filename.find_first_of('.', firstDot+1);
|
||||||
if (lastDot>firstDot && lastDot-firstDot<=5) { // potential ident, matches "^ZZ.IDENT."
|
if (lastDot>firstDot && lastDot-firstDot<=6) { // potential ident, matches "^ZZ.IDENT."
|
||||||
defaultCircuit = filename.substr(firstDot+1, lastDot-firstDot-1);
|
defaultCircuit = filename.substr(firstDot+1, lastDot-firstDot-1);
|
||||||
if (defaultCircuit.find_first_of(' ')!=string::npos)
|
if (defaultCircuit.find_first_of(' ')!=string::npos)
|
||||||
defaultCircuit = ""; // invalid: contains spaces
|
defaultCircuit = ""; // invalid: contains spaces
|
||||||
|
|||||||
Reference in New Issue
Block a user