v1.6.t1
The is not currently parsing multiple config files properly. Changed up the parser function without complicated check ahead logic. Will test if this works.
This commit is contained in:
parent
528b4105f7
commit
62a6139f3a
|
@ -282,29 +282,35 @@ bool rdConf(shared_t *share)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
string parseForParam(const string &arg, int argc, char** argv, bool argOnly, int &offs)
|
vector<string> parseForList(const string &arg, int argc, char** argv, bool argOnly, int count)
|
||||||
{
|
{
|
||||||
auto ret = string();
|
auto argPresent = false;
|
||||||
|
auto argCount = 0;
|
||||||
|
auto ret = vector<string>();
|
||||||
|
|
||||||
for (; offs < argc; ++offs)
|
for (auto i = 0; i < argc; ++i)
|
||||||
{
|
{
|
||||||
auto argInParams = string(argv[offs]);
|
auto argInParams = string(argv[i]);
|
||||||
|
|
||||||
if (arg.compare(argInParams) == 0)
|
if (argPresent)
|
||||||
{
|
{
|
||||||
if (!argOnly)
|
ret.push_back(argInParams);
|
||||||
{
|
|
||||||
offs++;
|
argPresent = false;
|
||||||
// check ahead, make sure offs + 1 won't cause out-of-range exception
|
|
||||||
if (offs <= (argc - 1))
|
|
||||||
{
|
|
||||||
ret = string(argv[offs]);
|
|
||||||
}
|
}
|
||||||
}
|
else if (arg.compare(argInParams) == 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ret = string("true");
|
argPresent = true; argCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argPresent && argOnly)
|
||||||
|
{
|
||||||
|
ret.push_back(string("true"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count != 0)
|
||||||
|
{
|
||||||
|
if (argCount >= count) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,29 +319,16 @@ string parseForParam(const string &arg, int argc, char** argv, bool argOnly, int
|
||||||
|
|
||||||
string parseForParam(const string &arg, int argc, char** argv, bool argOnly)
|
string parseForParam(const string &arg, int argc, char** argv, bool argOnly)
|
||||||
{
|
{
|
||||||
auto notUsed = 0;
|
auto params = parseForList(arg, argc, argv, argOnly, 1);
|
||||||
|
|
||||||
return parseForParam(arg, argc, argv, argOnly, notUsed);
|
if (params.empty())
|
||||||
}
|
|
||||||
|
|
||||||
vector<string> parseForList(const string &arg, int argc, char** argv)
|
|
||||||
{
|
|
||||||
auto offs = 0;
|
|
||||||
auto ret = vector<string>();
|
|
||||||
string param;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
param = parseForParam(arg, argc, argv, false, offs);
|
return string();
|
||||||
|
}
|
||||||
if (!param.empty())
|
else
|
||||||
{
|
{
|
||||||
ret.push_back(param);
|
return params[0];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
while (!param.empty());
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void waitForDetThreads(shared_t *share)
|
void waitForDetThreads(shared_t *share)
|
||||||
|
|
|
@ -35,7 +35,7 @@ using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace std::filesystem;
|
using namespace std::filesystem;
|
||||||
|
|
||||||
#define APP_VER "1.6"
|
#define APP_VER "1.6.t1"
|
||||||
#define APP_NAME "Motion Watch"
|
#define APP_NAME "Motion Watch"
|
||||||
|
|
||||||
struct shared_t
|
struct shared_t
|
||||||
|
@ -73,7 +73,6 @@ struct shared_t
|
||||||
string genDstFile(const string &dirOut, const char *fmt, const string &ext);
|
string genDstFile(const string &dirOut, const char *fmt, const string &ext);
|
||||||
string genTimeStr(const char *fmt);
|
string genTimeStr(const char *fmt);
|
||||||
string cleanDir(const string &path);
|
string cleanDir(const string &path);
|
||||||
string parseForParam(const string &arg, int argc, char** argv, bool argOnly, int &offs);
|
|
||||||
string parseForParam(const string &arg, int argc, char** argv, bool argOnly);
|
string parseForParam(const string &arg, int argc, char** argv, bool argOnly);
|
||||||
bool createDir(const string &dir);
|
bool createDir(const string &dir);
|
||||||
bool createDirTree(const string &full_path);
|
bool createDirTree(const string &full_path);
|
||||||
|
@ -84,7 +83,7 @@ void rdLine(const string ¶m, const string &line, int *value);
|
||||||
void statOut(shared_t *share);
|
void statOut(shared_t *share);
|
||||||
void waitForDetThreads(shared_t *share);
|
void waitForDetThreads(shared_t *share);
|
||||||
bool rdConf(shared_t *share);
|
bool rdConf(shared_t *share);
|
||||||
vector<string> parseForList(const string &arg, int argc, char** argv);
|
vector<string> parseForList(const string &arg, int argc, char** argv, bool argOnly = false, int count = 0);
|
||||||
vector<string> lsFilesInDir(const string &path, const string &ext = string());
|
vector<string> lsFilesInDir(const string &path, const string &ext = string());
|
||||||
vector<string> lsDirsInDir(const string &path);
|
vector<string> lsDirsInDir(const string &path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user