diff options
| author | Tannin <devnull@localhost> | 2014-02-07 21:05:48 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-02-07 21:05:48 +0100 |
| commit | 7aadb476376db1d23ad333abb439639552bb6e19 (patch) | |
| tree | 2e7ae9735ea8411dfb1486034e6ebd80b72c0d6c /src/mainwindow.cpp | |
| parent | 76fbe6effef7c2e787c1801741d4eb0a156128ce (diff) | |
- archives.txt is now written using the "safe"-write mechanism
- added the whole boss fork to the repository
- bugfix: boss db is now always re-initialised because otherwise there might have been differing results between runs
- bugfix: locked load order was ignored by integrated boss
- bugfix: archive list wasn't written back on all changes that affected it
- bugfix: CreateFile-hook didn't reroute files created with OPEN_ALWAYS to overwrite directory
- bugfix: NtQueryDirectoryFile-hook didn't return the correct status code when searching for a file that doesn't exist
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b6a744aa..d83d4d06 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -58,6 +58,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "problemsdialog.h" #include "previewdialog.h" #include "aboutdialog.h" +#include "safewritefile.h" #include <gameinfo.h> #include <appconfig.h> #include <utility.h> @@ -623,22 +624,18 @@ void MainWindow::createHelpWidget() void MainWindow::saveArchiveList() { if (m_ArchivesInit) { - QFile archiveFile(m_CurrentProfile->getArchivesFileName()); - if (archiveFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - for (int i = 0; i < ui->bsaList->topLevelItemCount(); ++i) { - QTreeWidgetItem *tlItem = ui->bsaList->topLevelItem(i); - for (int j = 0; j < tlItem->childCount(); ++j) { - QTreeWidgetItem *item = tlItem->child(j); - if (item->checkState(0) == Qt::Checked) { - archiveFile.write(item->text(0).toUtf8().append("\r\n")); - } + SafeWriteFile archiveFile(m_CurrentProfile->getArchivesFileName()); + for (int i = 0; i < ui->bsaList->topLevelItemCount(); ++i) { + QTreeWidgetItem *tlItem = ui->bsaList->topLevelItem(i); + for (int j = 0; j < tlItem->childCount(); ++j) { + QTreeWidgetItem *item = tlItem->child(j); + if (item->checkState(0) == Qt::Checked) { + archiveFile->write(item->text(0).toUtf8().append("\r\n")); } } - } else { - reportError(tr("failed to save archives order, do you have write access " - "to \"%1\"?").arg(m_CurrentProfile->getArchivesFileName())); } - archiveFile.close(); + archiveFile.commit(); + qDebug("%s saved", qPrintable(QDir::toNativeSeparators(m_CurrentProfile->getArchivesFileName()))); } else { qWarning("archive list not initialised"); } @@ -701,18 +698,13 @@ bool MainWindow::saveCurrentLists() return false; } - // save plugin list try { savePluginList(); + saveArchiveList(); } catch (const std::exception &e) { reportError(tr("failed to save load order: %1").arg(e.what())); } - // save only if the file doesn't exist at all, changes made in the ui are saved immediately - if (!QFile::exists(m_CurrentProfile->getArchivesFileName())) { - saveArchiveList(); - } - return true; } @@ -2709,6 +2701,8 @@ void MainWindow::modorder_changed() m_DirectoryStructure->getOriginByName(ToWString(modInfo->name())).setPriority(priority); } } + refreshBSAList(); + saveArchiveList(); m_DirectoryStructure->getFileRegister()->sortOrigins(); } @@ -3003,8 +2997,9 @@ void MainWindow::modlistChanged(const QModelIndex &index, int role) MessageDialog::showMessage(tr("Multiple esps activated, please check that they don't conflict."), this); } m_PluginList.refreshLoadOrder(); - // immediately save plugin list + // immediately save affected lists savePluginList(); + saveArchiveList(); } } } |
