Fix some Windows issues
This commit is contained in:
@@ -69,7 +69,10 @@ namespace OpenVulkano
|
||||
bool ArchiveReader::Open(const std::filesystem::path& archiveFile)
|
||||
{
|
||||
PrepOpen();
|
||||
ChkErr(archive_read_open_filename(m_archive, archiveFile.c_str(), BUFFER_SIZE));
|
||||
if constexpr (std::is_same_v<std::filesystem::path::value_type, char>)
|
||||
ChkErr(archive_read_open_filename(m_archive, archiveFile.c_str(), BUFFER_SIZE));
|
||||
else
|
||||
ChkErr(archive_read_open_filename_w(m_archive, (wchar_t*)archiveFile.c_str(), BUFFER_SIZE));
|
||||
ReadNextHeader();
|
||||
return HasNext();
|
||||
}
|
||||
@@ -221,7 +224,7 @@ namespace OpenVulkano
|
||||
{
|
||||
size_t count = 0;
|
||||
std::optional<FileDescription> fd;
|
||||
while (fd = ExtractNext(targetDir))
|
||||
while ((fd = ExtractNext(targetDir)))
|
||||
{
|
||||
extractionCallback(fd.value());
|
||||
count++;
|
||||
@@ -276,14 +279,14 @@ namespace OpenVulkano
|
||||
if (SkipTill(std::filesystem::file_type::regular))
|
||||
{
|
||||
FileDescription fileDescription = GetNextDescription();
|
||||
std::filesystem::path outputFilePath;
|
||||
std::string outputFilePath;
|
||||
if (m_filePathRewrite)
|
||||
outputFilePath = targetDir / m_filePathRewrite(fileDescription.path);
|
||||
outputFilePath = (targetDir / m_filePathRewrite(fileDescription.path)).string();
|
||||
else
|
||||
outputFilePath = targetDir / fileDescription.path;
|
||||
outputFilePath = (targetDir / fileDescription.path).string();
|
||||
|
||||
std::unique_ptr<archive, decltype(archive_write_free)*> a(archive_write_disk_new(), archive_write_free);
|
||||
std::unique_ptr<archive_entry, decltype(archive_entry_free)*> entry(archive_entry_clone(m_archiveEntry), archive_entry_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);
|
||||
|
||||
archive_entry_set_pathname(entry.get(), outputFilePath.c_str());
|
||||
|
||||
|
||||
@@ -56,8 +56,7 @@ namespace OpenVulkano
|
||||
[[nodiscard]] std::filesystem::path GetXDGFolderDefault(const char* envName, std::string_view defaultRelativePath)
|
||||
{
|
||||
#ifndef TARGET_OS_IOS != 1
|
||||
const char* envValue = std::getenv(envName);
|
||||
if (envValue)
|
||||
if (const char* envValue = std::getenv(envName))
|
||||
{
|
||||
if (envValue[0] == '/') return envValue;
|
||||
std::cerr << "Ignoring environment '" << envName << "' (value: '" << envValue << "') because it's relative! XDG specifies it should be absolute path. Falling back to default path.";
|
||||
|
||||
Reference in New Issue
Block a user