From d6cade25f4ac6b2ebac9d4830ab7b10294bc4c89 Mon Sep 17 00:00:00 2001 From: WaluigiWare64 <68647953+WaluigiWare64@users.noreply.github.com> Date: Sat, 19 Dec 2020 17:41:51 +0000 Subject: [PATCH] Extract ROM to new folder next to archive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example if DS_ROMS.zip had game.nds, the directory structure would be: ├── DS_ROMS │   └── game.nds └── DS_ROMS.zip --- src/frontend/qt_sdl/ArchiveUtil.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontend/qt_sdl/ArchiveUtil.cpp b/src/frontend/qt_sdl/ArchiveUtil.cpp index 6457b4fe..98851917 100644 --- a/src/frontend/qt_sdl/ArchiveUtil.cpp +++ b/src/frontend/qt_sdl/ArchiveUtil.cpp @@ -87,8 +87,9 @@ QVector ExtractFileFromArchive(const char* path, const char* wantedFile return QVector {"Err", archive_error_string(a)}; } - const char* fileToWrite = archive_entry_pathname(entry); - std::ofstream(fileToWrite, std::ofstream::binary).write((char*)archiveBuffer.get(), bytesToWrite); + QString fileToWrite = QFileInfo(path).absolutePath() + "/" + QFileInfo(dirToWrite).baseName() + "/" + archive_entry_pathname(entry); + + std::ofstream(fileToWrite.toUtf8().constData(), std::ofstream::binary).write((char*)archiveBuffer.get(), bytesToWrite); archiveBuffer.reset(nullptr); archive_read_close(a);