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

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