| 132 | } |
| 133 | |
| 134 | int ReadFileData(const std::string& filePath, uint8_t* buf, size_t bufSize) { |
| 135 | std::ifstream file(filePath, std::ios::binary | std::ios::ate); |
| 136 | if (!file) { |
| 137 | return 0; |
| 138 | } |
| 139 | |
| 140 | size_t fileSize = file.tellg(); |
| 141 | file.seekg(0); |
| 142 | file.read(reinterpret_cast<char*>(buf), std::min(fileSize, bufSize)); |
| 143 | if (fileSize < bufSize) { |
| 144 | buf[fileSize] = '\0'; |
| 145 | } |
| 146 | return std::min(fileSize, bufSize); |
| 147 | } |
| 148 | |
| 149 | std::string GetFileName(const std::string& filePath) { |
| 150 | return PathToUtf8(Utf8ToPath(filePath).filename()); |
no test coverage detected