| | |
| | | strText.Format(_T("%.03f"), value); |
| | | pWnd->SetDlgItemText(nCtrlId, strText); |
| | | } |
| | | |
| | | std::vector<CString> CToolUnits::GetFileNamesInDirectory(const CString& strFolderPath, const CString& strExtension) |
| | | { |
| | | std::vector<CString> fileNames; |
| | | |
| | | // 确保目录路径最后有反斜杠 |
| | | CString strSearchPath = strFolderPath; |
| | | if (strSearchPath[strSearchPath.GetLength() - 1] != '\\') { |
| | | strSearchPath += '\\'; |
| | | } |
| | | |
| | | CString finalExtension = strExtension; |
| | | if (finalExtension.Find('.') == -1) { |
| | | finalExtension = '.' + finalExtension; |
| | | } |
| | | strSearchPath += "*" + finalExtension; |
| | | |
| | | std::unique_ptr<CFileFind> finder = std::make_unique<CFileFind>(); |
| | | BOOL bWorking = finder->FindFile(strSearchPath); |
| | | |
| | | // 遍历文件夹 |
| | | while (bWorking) { |
| | | bWorking = finder->FindNextFile(); |
| | | if (!finder->IsDirectory()) { |
| | | CString fileName = finder->GetFileName(); |
| | | int dotPos = fileName.ReverseFind('.'); |
| | | if (dotPos != -1) { |
| | | fileName = fileName.Left(dotPos); |
| | | } |
| | | fileNames.push_back(fileName); |
| | | } |
| | | } |
| | | |
| | | return fileNames; |
| | | } |
| | | |
| | | std::string CToolUnits::getRecipePath() |
| | | { |
| | | return getCurrentExePath() + "\\Recipe"; |
| | | } |