kopia lustrzana https://github.com/weetmuts/wmbusmeters
Only try loading driver from disk if the driver name ends with .xmq and is a valid file.
rodzic
3a097388f5
commit
b9306be914
|
@ -22,6 +22,9 @@
|
|||
|
||||
bool DriverDynamic::load(DriverInfo *di, const string &file)
|
||||
{
|
||||
if (!endsWith(file, ".xmq")) return false;
|
||||
if (!checkFileExists(file.c_str())) return false;
|
||||
|
||||
XMQDoc *doc = xmqNewDoc();
|
||||
|
||||
bool ok = xmqParseFile(doc, file.c_str(), "config");
|
||||
|
|
|
@ -2452,3 +2452,8 @@ bool is_lowercase_alnum_text(const char *text)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool endsWith(const std::string& str, const std::string& suffix)
|
||||
{
|
||||
return str.size() >= suffix.size() && 0 == str.compare(str.size()-suffix.size(), suffix.size(), suffix);
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ std::string safeString(std::vector<uchar> &target);
|
|||
void strprintf(std::string *s, const char* fmt, ...);
|
||||
std::string tostrprintf(const char* fmt, ...);
|
||||
std::string tostrprintf(const std::string &fmt, ...);
|
||||
bool endsWith(const std::string &str, const std::string &suffix);
|
||||
|
||||
// Return for example: 2010-03-21
|
||||
std::string strdate(struct tm *date);
|
||||
|
|
Ładowanie…
Reference in New Issue