From 9f61ef5c9e6c8884a14b7d6f1507199f61a64377 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Mon, 12 Mar 2018 19:53:43 +0100 Subject: Added a check to the preview function to handle tha case of the file beeing from the actual data folder instead of a mod. --- src/mainwindow.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 83a12437..bdf79bd5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3929,10 +3929,22 @@ void MainWindow::previewDataFile() // what we have is an absolute path to the file in its actual location (for the primary origin) // what we want is the path relative to the virtual data directory - // crude: we search for the next slash after the base mod directory to skip everything up to the data-relative directory - int offset = m_OrganizerCore.settings().getModDirectory().size() + 1; - offset = fileName.indexOf("/", offset); - fileName = fileName.mid(offset + 1); + // we need to look in the virtual directory for the file to make sure the info is up to date. + + // check if the file comes from the actual data folder instead of a mod + QDir gameDirectory = m_OrganizerCore.managedGame()->dataDirectory().absolutePath(); + QString relativePath = gameDirectory.relativeFilePath(fileName); + if (!relativePath.startsWith("..")) { + fileName = relativePath; + } + else { + // crude: we search for the next slash after the base mod directory to skip everything up to the data-relative directory + int offset = m_OrganizerCore.settings().getModDirectory().size() + 1; + offset = fileName.indexOf("/", offset); + fileName = fileName.mid(offset + 1); + } + + const FileEntry::Ptr file = m_OrganizerCore.directoryStructure()->searchFile(ToWString(fileName), nullptr); -- cgit v1.3.1 From ccb5ad53e22e54f416c4cc3f33c2b57d0b1b672a Mon Sep 17 00:00:00 2001 From: Al12rs Date: Mon, 12 Mar 2018 23:18:03 +0100 Subject: Fixed wrong Nexus page url in CSV export. --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bdf79bd5..5be5cef3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3201,7 +3201,7 @@ void MainWindow::exportModListCSV() if (nexus_ID->isChecked()) builder.setRowField("#Nexus_ID", info->getNexusID()); if (mod_Nexus_URL->isChecked()) - builder.setRowField("#Mod_Nexus_URL", info->getURL()); + builder.setRowField("#Mod_Nexus_URL",(info->getNexusID()>0)? NexusInterface::instance()->getModURL(info->getNexusID()) : ""); if (mod_Version->isChecked()) builder.setRowField("#Mod_Version", info->getVersion().canonicalString()); if (install_Date->isChecked()) -- cgit v1.3.1