mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 21:12:47 +08:00
Added windows function to find relative dir of exe for conf and runtime
data
This commit is contained in:
@@ -7,4 +7,25 @@ void sleep_ms(int sleepMs)
|
||||
#else
|
||||
usleep(sleepMs * 1000); // usleep takes sleep time in us (1 millionth of a second)
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string getExeDir()
|
||||
{
|
||||
#ifdef WINDOWS
|
||||
TCHAR szEXEPath[2048];
|
||||
std::stringstream ss;
|
||||
GetModuleFileName(NULL, szEXEPath, 2048);
|
||||
ss << szEXEPath;
|
||||
|
||||
std::string exeFile = ss.str();
|
||||
std::string directory;
|
||||
const size_t last_slash_idx = exeFile.rfind('\\');
|
||||
if (std::string::npos != last_slash_idx)
|
||||
{
|
||||
directory = exeFile.substr(0, last_slash_idx);
|
||||
}
|
||||
return directory;
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user