Lines Matching refs:std
27 namespace fs = std::filesystem;
29 bool MockFile::SimulateFileLock(const std::string& filePath)
56 bool MockFile::ReleaseFileLock(const std::string& filePath)
82 bool MockFile::AddFileToZip(zipFile zip, const std::string& filePath, const std::string& entryName)
86 std::cerr << "Failed to create entry in zip file for " << filePath << std::endl;
92 std::cerr << "Failed to open file " << filePath << std::endl;
102 std::cerr << "Failed to write to zip for " << filePath << std::endl;
105 std::cerr << "Failed to close file" << std::endl;
115 std::cerr << "Failed to close file" << std::endl;
124 bool MockFile::AddFolderToZip(zipFile zip, const std::string& folderPath, const std::string& entryName)
127 std::string relativePath = entry.path().string().substr(folderPath.length() + 1); // Relative path
133 std::cerr << "Failed to create entry in zip file for " << entry.path() << std::endl;
149 bool MockFile::CompressFiles(const std::vector<std::string>& files, const std::string& zipFilename)
153 std::cerr << "Could not create zip file " << zipFilename << std::endl;
174 std::cerr << "Failed to close zip file " << zipFilename << std::endl;
183 void WriteToFile(const std::string& filePath, const std::string& content)
185 std::ofstream file(filePath);
187 std::cerr << "Error creating file: " << filePath << std::endl;
194 void CreateFiles(const std::string hspAbcContent)
196 std::filesystem::path dir("ets");
199 if (std::filesystem::exists(dir)) {
200 std::cout << "Folder already exists." << std::endl;
203 std::filesystem::create_directory(dir);
204 std::cout << "Folder created successfully." << std::endl;
214 std::string MockFile::CreateHspFile(const std::string hspFileName, const std::string hspAbcContent)
217 std::vector<std::string> filesToCompress = { "ets", "module.json" };
218 std::string zipFilename = hspFileName + ".zip";
219 std::string newFileName = hspFileName + ".hsp";
221 std::cout << "Compression successful. File created: " << zipFilename << std::endl;
222 if (std::rename(zipFilename.c_str(), newFileName.c_str()) != 0) {
223 std::cout << newFileName << " 创建hsp文件失败" << std::endl;
227 std::cerr << "Compression failed." << std::endl;