summaryrefslogtreecommitdiff
path: root/src/usvfsconnector.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2017-12-09 23:44:21 -0600
committerGitHub <noreply@github.com>2017-12-09 23:44:21 -0600
commitb2d7181ca77980622f27a5e2a27c636d25a0a598 (patch)
treec3e2280cf8e2caa025a0856d4f8a7165149e76ac /src/usvfsconnector.cpp
parent0aaece55d8b5bb392523db4ee96029d0567294e8 (diff)
parent689248619ada12eb9e50ea40963a04c946cb3e13 (diff)
Merge pull request #139 from erasmux/better_diagnostics_and_shortcuts_fix
Better diagnostics and shortcuts fix
Diffstat (limited to 'src/usvfsconnector.cpp')
-rw-r--r--src/usvfsconnector.cpp44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/usvfsconnector.cpp b/src/usvfsconnector.cpp
index 0420ddc2..ffbdf3aa 100644
--- a/src/usvfsconnector.cpp
+++ b/src/usvfsconnector.cpp
@@ -19,6 +19,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "usvfsconnector.h"
#include "settings.h"
+#include "organizercore.h"
+#include "shared/util.h"
#include <memory>
#include <sstream>
#include <iomanip>
@@ -27,6 +29,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QProgressDialog>
#include <QDateTime>
#include <QCoreApplication>
+#include <qstandardpaths.h>
static const char SHMID[] = "mod_organizer_instance";
@@ -101,14 +104,33 @@ LogLevel logLevel(int level)
}
}
+CrashDumpsType crashDumpsType(int type)
+{
+ switch (type) {
+ case CrashDumpsType::Mini:
+ return CrashDumpsType::Mini;
+ case CrashDumpsType::Data:
+ return CrashDumpsType::Data;
+ case CrashDumpsType::Full:
+ return CrashDumpsType::Full;
+ default:
+ return CrashDumpsType::None;
+ }
+}
+
UsvfsConnector::UsvfsConnector()
{
USVFSParameters params;
LogLevel level = logLevel(Settings::instance().logLevel());
- USVFSInitParameters(&params, SHMID, false, level);
+ CrashDumpsType dumpType = crashDumpsType(Settings::instance().crashDumpsType());
+
+ std::string dumpPath = MOShared::ToString(OrganizerCore::crashDumpsPath(), true);
+ USVFSInitParameters(&params, SHMID, false, level, dumpType, dumpPath.c_str());
InitLogging(false);
+
+ qDebug("Initializing VFS <%s, %d, %d, %s>", params.instanceName, params.logLevel, params.crashDumpsType, params.crashDumpsPath);
+
CreateVFS(&params);
- SetLogLevel(level);
BlacklistExecutable(L"TSVNCache.exe");
@@ -136,6 +158,10 @@ void UsvfsConnector::updateMapping(const MappingType &mapping)
progress.setMaximum(static_cast<int>(mapping.size()));
progress.show();
int value = 0;
+ int files = 0;
+ int dirs = 0;
+
+ qDebug("Updating VFS mappings...");
ClearVirtualMappings();
@@ -151,11 +177,15 @@ void UsvfsConnector::updateMapping(const MappingType &mapping)
(map.createTarget ? LINKFLAG_CREATETARGET : 0)
| LINKFLAG_RECURSIVE
);
+ ++dirs;
} else {
VirtualLinkFile(map.source.toStdWString().c_str(),
map.destination.toStdWString().c_str(), 0);
+ ++files;
}
}
+
+ qDebug("VFS mappings updated <linked %d dirs, %d files>", dirs, files);
/*
size_t dumpSize = 0;
CreateVFSDump(nullptr, &dumpSize);
@@ -165,12 +195,6 @@ void UsvfsConnector::updateMapping(const MappingType &mapping)
*/
}
-void UsvfsConnector::setLogLevel(int logLevel) {
- switch (logLevel) {
- case LogLevel::Debug: SetLogLevel(LogLevel::Debug); break;
- case LogLevel::Info: SetLogLevel(LogLevel::Info); break;
- case LogLevel::Warning: SetLogLevel(LogLevel::Warning); break;
- case LogLevel::Error: SetLogLevel(LogLevel::Error); break;
- default: SetLogLevel(LogLevel::Debug); break;
- }
+void UsvfsConnector::updateParams(int logLevel, int crashDumpsType) {
+ USVFSUpdateParams(::logLevel(logLevel), ::crashDumpsType(crashDumpsType));
}