diff --git a/openVulkanoCpp/IO/Archive/ArchiveReader.cpp b/openVulkanoCpp/IO/Archive/ArchiveReader.cpp index 4afb3e6..a92d4aa 100644 --- a/openVulkanoCpp/IO/Archive/ArchiveReader.cpp +++ b/openVulkanoCpp/IO/Archive/ArchiveReader.cpp @@ -87,9 +87,10 @@ namespace openVulkanoCpp std::regex fileRegex(fileNamePattern); for(auto const& dirEntry : std::filesystem::directory_iterator(dir)) { - if (std::regex_match(dirEntry.path().native(), fileRegex)) + std::string entryPath = dirEntry.path().string(); + if (std::regex_match(entryPath, fileRegex)) { - files.push_back(dirEntry.path().native()); + files.push_back(std::move(entryPath)); } } @@ -138,7 +139,7 @@ namespace openVulkanoCpp bool ArchiveReader::SkipTill(std::filesystem::file_type type) { - mode_t typeId = LibArchiveHelper::FILE_TYPE_MAP[static_cast(type)]; + mode_t typeId = LibArchiveHelper::GetFileType(type); if (typeId == AE_IFMT) throw std::invalid_argument("Invalid file type"); while(HasNext() && archive_entry_filetype(m_archiveEntry) != typeId) { diff --git a/openVulkanoCpp/IO/Archive/ArchiveWriter.cpp b/openVulkanoCpp/IO/Archive/ArchiveWriter.cpp index 949439f..863cb75 100644 --- a/openVulkanoCpp/IO/Archive/ArchiveWriter.cpp +++ b/openVulkanoCpp/IO/Archive/ArchiveWriter.cpp @@ -111,16 +111,17 @@ namespace openVulkanoCpp archive_write_close(m_archive); } - bool ArchiveWriter::AddFile(const char* fileName) + bool ArchiveWriter::AddFile(const char* filePath) { - std::filesystem::path path(fileName); + std::filesystem::path path(filePath); + std::string fileName = path.filename().string(); if (std::filesystem::is_regular_file(path)) { - return AddFile(fileName, path.filename().c_str()); + return AddFile(filePath, fileName.c_str()); } else if (std::filesystem::is_directory(path)) { - AddFiles(fileName, path.filename().c_str()); + AddFiles(filePath, fileName.c_str()); } return false; } @@ -208,14 +209,18 @@ namespace openVulkanoCpp bool ArchiveWriter::AddFiles(const std::filesystem::path& dirName, const std::string& inArchiveDirName) { - AddFile(dirName.c_str(), inArchiveDirName.c_str()); + std::string sDirName = dirName.string(); + AddFile(sDirName.c_str(), inArchiveDirName.c_str()); for(const auto& entry : std::filesystem::directory_iterator(dirName)) { - std::string fPath = inArchiveDirName + "/" + entry.path().filename().native(); + std::string fPath = inArchiveDirName + "/" + entry.path().filename().string(); if (entry.is_directory()) AddFiles(entry, fPath); - else AddFile(entry.path().c_str(), fPath.c_str()); + else + { + std::string entryName = entry.path().string(); + AddFile(entryName.c_str(), fPath.c_str()); + } } return true; } - } \ No newline at end of file