windows building again
This commit is contained in:
@ -6,14 +6,14 @@
|
||||
|
||||
ReturnValue_t FilesystemMock::feedFile(const std::string &filename, std::ifstream &file) {
|
||||
// not multibyte encoding safe!
|
||||
std::basic_string<std::filesystem::path::value_type> native_filename(filename.begin(),
|
||||
std::filesystem::path::string_type native_filename(filename.begin(),
|
||||
filename.end());
|
||||
|
||||
if (not std::filesystem::exists(native_filename)) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
size_t fileSize = std::filesystem::file_size(native_filename);
|
||||
FileOpParams params(native_filename.c_str(), fileSize);
|
||||
FileOpParams params(filename.c_str(), fileSize);
|
||||
std::vector<uint8_t> rawData(fileSize);
|
||||
file.read(reinterpret_cast<char *>(rawData.data()), static_cast<unsigned int>(rawData.size()));
|
||||
createOrAddToFile(params, rawData.data());
|
||||
@ -27,7 +27,8 @@ ReturnValue_t FilesystemMock::writeToFile(FileOpParams params, const uint8_t *da
|
||||
|
||||
ReturnValue_t FilesystemMock::readFromFile(FileOpParams params, uint8_t **buffer, size_t &readSize,
|
||||
size_t maxSize) {
|
||||
std::basic_string<std::filesystem::path::value_type> filename(params.path());
|
||||
std::string filename_c(params.fsParams.path);
|
||||
std::filesystem::path::string_type filename(filename_c.cbegin(), filename_c.cend());
|
||||
auto iter = fileMap.find(filename);
|
||||
if (iter == fileMap.end()) {
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
@ -57,9 +58,10 @@ ReturnValue_t FilesystemMock::createFile(FilesystemParams params, const uint8_t
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FilesystemMock::removeFile(const std::filesystem::path::value_type *path,
|
||||
ReturnValue_t FilesystemMock::removeFile(const char *path,
|
||||
FileSystemArgsIF *args) {
|
||||
std::basic_string<std::filesystem::path::value_type> filename(path);
|
||||
std::string filename_c(path);
|
||||
std::filesystem::path::string_type filename(filename_c.cbegin(), filename_c.cend());
|
||||
|
||||
auto iter = fileMap.find(filename);
|
||||
if (iter == fileMap.end()) {
|
||||
@ -71,28 +73,31 @@ ReturnValue_t FilesystemMock::removeFile(const std::filesystem::path::value_type
|
||||
}
|
||||
|
||||
ReturnValue_t FilesystemMock::createDirectory(FilesystemParams params, bool createParentDirs) {
|
||||
auto dirPath = params.path;
|
||||
std::string dirPath_c(params.path);
|
||||
std::filesystem::path::string_type dirPath(dirPath_c.cbegin(), dirPath_c.cend());
|
||||
dirMap[dirPath].createCallCount++;
|
||||
dirMap[dirPath].wihParentDir.push(createParentDirs);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FilesystemMock::removeDirectory(FilesystemParams params, bool deleteRecurively) {
|
||||
auto dirPath = params.path;
|
||||
std::string dirPath_c(params.path);
|
||||
std::filesystem::path::string_type dirPath(dirPath_c.cbegin(), dirPath_c.cend());
|
||||
dirMap[dirPath].delCallCount++;
|
||||
dirMap[dirPath].recursiveDeletion.push(deleteRecurively);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FilesystemMock::rename(const std::filesystem::path::value_type *oldPath,
|
||||
const std::filesystem::path::value_type *newPath,
|
||||
ReturnValue_t FilesystemMock::rename(const char *oldPath,
|
||||
const char *newPath,
|
||||
FileSystemArgsIF *args) {
|
||||
renameQueue.push(RenameInfo(oldPath, newPath));
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void FilesystemMock::createOrAddToFile(FileOpParams params, const uint8_t *data) {
|
||||
auto filename(params.path());
|
||||
std::string filename_c(params.fsParams.path);
|
||||
std::filesystem::path::string_type filename(filename_c.cbegin(), filename_c.cend());
|
||||
auto iter = fileMap.find(filename);
|
||||
if (iter == fileMap.end()) {
|
||||
FileSegmentQueue queue;
|
||||
@ -133,7 +138,8 @@ void FilesystemMock::reset() {
|
||||
}
|
||||
|
||||
bool FilesystemMock::fileExists(FilesystemParams params) {
|
||||
auto filename(params.path);
|
||||
std::string filename_c(params.path);
|
||||
std::filesystem::path::string_type filename(filename_c.cbegin(), filename_c.cend());
|
||||
auto iter = fileMap.find(filename);
|
||||
if (iter == fileMap.end()) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user