Explorar o código

Z991239-6255 #comment feat: 指纹扫模拟器增加图片生成到旧目录功能

Signed-Off-By: commit-hook
刘文涛80174520 hai 4 meses
pai
achega
2bdd38b843
Modificáronse 1 ficheiros con 34 adicións e 0 borrados
  1. 34 0
      DevAdapter/simulator/FingerPrint.1.1/FingerPrint_impl.cpp

+ 34 - 0
DevAdapter/simulator/FingerPrint.1.1/FingerPrint_impl.cpp

@@ -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());