diff options
author | WaluigiWare64 <68647953+WaluigiWare64@users.noreply.github.com> | 2020-12-19 17:41:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-19 17:41:51 +0000 |
commit | d6cade25f4ac6b2ebac9d4830ab7b10294bc4c89 (patch) | |
tree | 05351d758447bc258f665b03342a8b76951048c2 /src/frontend/qt_sdl | |
parent | 8d70d0926c6307368398a894cbebfbdc0f538194 (diff) |
Extract ROM to new folder next to archive
For example if DS_ROMS.zip had game.nds, the directory structure would be:
├── DS_ROMS
│ └── game.nds
└── DS_ROMS.zip
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r-- | src/frontend/qt_sdl/ArchiveUtil.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/frontend/qt_sdl/ArchiveUtil.cpp b/src/frontend/qt_sdl/ArchiveUtil.cpp index 6457b4f..9885191 100644 --- a/src/frontend/qt_sdl/ArchiveUtil.cpp +++ b/src/frontend/qt_sdl/ArchiveUtil.cpp @@ -87,8 +87,9 @@ QVector<QString> ExtractFileFromArchive(const char* path, const char* wantedFile return QVector<QString> {"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); |