Update path handling

This commit is contained in:
Georg Hagen
2025-05-21 23:00:51 +02:00
parent 6f7baf8f56
commit 3675a4e4a3

View File

@@ -284,16 +284,19 @@ namespace OpenVulkano
if (SkipTill(std::filesystem::file_type::regular)) if (SkipTill(std::filesystem::file_type::regular))
{ {
FileDescription fileDescription = GetNextDescription(); FileDescription fileDescription = GetNextDescription();
std::string outputFilePath; std::filesystem::path outputFilePath;
if (m_filePathRewrite) if (m_filePathRewrite)
outputFilePath = (targetDir / m_filePathRewrite(fileDescription.path)).string(); outputFilePath = targetDir / m_filePathRewrite(fileDescription.path);
else else
outputFilePath = (targetDir / fileDescription.path).string(); outputFilePath = targetDir / static_cast<const std::string&>(fileDescription.path);
const std::unique_ptr<archive, decltype(archive_write_free)*> a(archive_write_disk_new(), archive_write_free); const std::unique_ptr<archive, decltype(archive_write_free)*> a(archive_write_disk_new(), archive_write_free);
const std::unique_ptr<archive_entry, decltype(archive_entry_free)*> entry(archive_entry_clone(m_archiveEntry), archive_entry_free); const std::unique_ptr<archive_entry, decltype(archive_entry_free)*> entry(archive_entry_clone(m_archiveEntry), archive_entry_free);
archive_entry_set_pathname(entry.get(), outputFilePath.c_str()); if constexpr (std::is_same_v<std::filesystem::path::value_type, char>)
archive_entry_set_pathname(entry.get(), (const char*)outputFilePath.c_str());
else
archive_entry_copy_pathname_w(entry.get(), (const wchar_t*)outputFilePath.c_str());
ChkErr(archive_write_disk_set_options(a.get(), ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL | ARCHIVE_EXTRACT_FFLAGS)); ChkErr(archive_write_disk_set_options(a.get(), ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL | ARCHIVE_EXTRACT_FFLAGS));