|
@@ -104,6 +104,40 @@ ErrorCodeEnum FingerPrintImpl::Image2Feature(const char* imageName, LPBYTE lpbFe
|
|
|
string imgPath = GetCurrentDirectory() + SPLIT_SLASH_STR + imgName;
|
|
|
writeFile(imgPath.c_str());
|
|
|
}
|
|
|
+ else if (ans.bGenerateFile == 2) {
|
|
|
+#ifdef _MSC_VER
|
|
|
+ char exePath[MAX_PATH] = { 0 };
|
|
|
+ if (GetModuleFileName(NULL, exePath, MAX_PATH) == 0) {
|
|
|
+ LOG4VTM(INFO, "Failed to get executable path.");
|
|
|
+ return Error_Interact;
|
|
|
+ }
|
|
|
+ char* lastSlash = strrchr(exePath, '\\');
|
|
|
+ if (lastSlash != NULL) {
|
|
|
+ *lastSlash = '\0'; // 将最后一个反斜杠替换为字符串终止符,得到目录路径
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ LOG4VTM(INFO, "Executable path does not contain directory.");
|
|
|
+ return Error_Interact;
|
|
|
+ }
|
|
|
+ lastSlash = strrchr(exePath, '\\');
|
|
|
+ if (lastSlash != NULL) {
|
|
|
+ *lastSlash = '\0'; // 将最后一个反斜杠替换为字符串终止符,得到目录路径
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ LOG4VTM(INFO, "Executable path does not contain directory2.");
|
|
|
+ return Error_Interact;
|
|
|
+ }
|
|
|
+ LOG4VTM(INFO, "path: " << exePath);
|
|
|
+
|
|
|
+ string imgName(imageName);
|
|
|
+ string newPath(exePath);
|
|
|
+ string imgPath = newPath + SPLIT_SLASH_STR + "dep" + SPLIT_SLASH_STR + imgName;
|
|
|
+ LOG4VTM(INFO, "dep path: " << imgPath);
|
|
|
+ writeFile(imgPath.c_str());
|
|
|
+#else
|
|
|
+ return Error_NotSupport;
|
|
|
+#endif
|
|
|
+ }
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
strcpy_s((char*)lpbFeature, 1024, ans.lpbFeature.c_str());
|