Fix windows build issues

This commit is contained in:
2021-02-10 02:43:11 +01:00
parent 9584ec77f1
commit 339afdcfa1
2 changed files with 17 additions and 11 deletions

View File

@@ -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<int>(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)
{

View File

@@ -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;
}
}