mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 06:46:53 +08:00
Replace CMAKE_INSTALL_PREFIX from default config if it hasn't been swapped out by CMAKE
This commit is contained in:
@@ -167,6 +167,11 @@ namespace alpr
|
|||||||
|
|
||||||
runtimeBaseDir = getString(ini,defaultIni, "", "runtime_dir", DEFAULT_RUNTIME_DATA_DIR);
|
runtimeBaseDir = getString(ini,defaultIni, "", "runtime_dir", DEFAULT_RUNTIME_DATA_DIR);
|
||||||
|
|
||||||
|
// Special hack to allow config files to work if the package hasn't been installed
|
||||||
|
// Cmake will do this replacement on deploy, but this is useful in development
|
||||||
|
if (runtimeBaseDir.find("${CMAKE_INSTALL_PREFIX}") >= 0)
|
||||||
|
runtimeBaseDir = replaceAll(runtimeBaseDir, "${CMAKE_INSTALL_PREFIX}", INSTALL_PREFIX);
|
||||||
|
|
||||||
std::string detectorString = getString(ini, defaultIni, "", "detector", "lbpcpu");
|
std::string detectorString = getString(ini, defaultIni, "", "detector", "lbpcpu");
|
||||||
std::transform(detectorString.begin(), detectorString.end(), detectorString.begin(), ::tolower);
|
std::transform(detectorString.begin(), detectorString.end(), detectorString.begin(), ::tolower);
|
||||||
|
|
||||||
|
@@ -613,6 +613,15 @@ int levenshteinDistance (const std::string &s1, const std::string &s2, int max)
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string replaceAll(std::string str, const std::string& from, const std::string& to) {
|
||||||
|
size_t start_pos = 0;
|
||||||
|
while((start_pos = str.find(from, start_pos)) != std::string::npos) {
|
||||||
|
str.replace(start_pos, from.length(), to);
|
||||||
|
start_pos += to.length(); // Handles case where 'to' is a substring of 'from'
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
// trim from start
|
// trim from start
|
||||||
std::string <rim(std::string &s) {
|
std::string <rim(std::string &s) {
|
||||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
||||||
|
@@ -115,6 +115,8 @@ namespace alpr
|
|||||||
std::string toString(float value);
|
std::string toString(float value);
|
||||||
std::string toString(double value);
|
std::string toString(double value);
|
||||||
|
|
||||||
|
std::string replaceAll(std::string str, const std::string& from, const std::string& to);
|
||||||
|
|
||||||
std::string <rim(std::string &s);
|
std::string <rim(std::string &s);
|
||||||
std::string &rtrim(std::string &s);
|
std::string &rtrim(std::string &s);
|
||||||
std::string &trim(std::string &s);
|
std::string &trim(std::string &s);
|
||||||
|
Reference in New Issue
Block a user