diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2017-10-31 21:29:12 -0500 |
|---|---|---|
| committer | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2017-10-31 21:29:12 -0500 |
| commit | 087f3841f3dbf92936ac30e935520c728fef1776 (patch) | |
| tree | 44ebe37039d15e9b182e57a49f66e924e07b5566 /src/loadmechanism.cpp | |
| parent | 627660ebb73d2da6994053ea1fd6eee1ba15ba38 (diff) | |
If architecture is not detected, skip handling
Diffstat (limited to 'src/loadmechanism.cpp')
| -rw-r--r-- | src/loadmechanism.cpp | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp index a2050512..7ad36ac7 100644 --- a/src/loadmechanism.cpp +++ b/src/loadmechanism.cpp @@ -142,12 +142,14 @@ void LoadMechanism::deactivateScriptExtender() vfsDLLName = ToQString(AppConfig::vfs64DLLName());
}
qDebug("USVFS DLL Name: " + vfsDLLName.toLatin1());
- if (QFile(pluginsDir.absoluteFilePath(vfsDLLName)).exists()) {
- // remove dll from SE plugins directory
- if (!pluginsDir.remove(vfsDLLName)) {
- throw MyException(QObject::tr("Failed to delete %1").arg(pluginsDir.absoluteFilePath(vfsDLLName)));
- }
- }
+ if (vfsDLLName != "") {
+ if (QFile(pluginsDir.absoluteFilePath(vfsDLLName)).exists()) {
+ // remove dll from SE plugins directory
+ if (!pluginsDir.remove(vfsDLLName)) {
+ throw MyException(QObject::tr("Failed to delete %1").arg(pluginsDir.absoluteFilePath(vfsDLLName)));
+ }
+ }
+ }
removeHintFile(pluginsDir);
} catch (const std::exception &e) {
@@ -201,36 +203,37 @@ void LoadMechanism::activateScriptExtender() }
#pragma message("implement this for usvfs")
- QString targetPath;
- QString vfsDLLPath;
+ std::wstring vfsDLL = L"";
if (extender->getArch() == IMAGE_FILE_MACHINE_I386) {
- targetPath = pluginsDir.absoluteFilePath(ToQString(AppConfig::vfs32DLLName()));
- vfsDLLPath = qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::vfs32DLLName());
+ vfsDLL = AppConfig::vfs32DLLName();
}
else if (extender->getArch() == IMAGE_FILE_MACHINE_AMD64)
{
- targetPath = pluginsDir.absoluteFilePath(ToQString(AppConfig::vfs64DLLName()));
- vfsDLLPath = qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::vfs64DLLName());
+ vfsDLL = AppConfig::vfs64DLLName();
}
+ if (vfsDLL != L"") {
+ QString targetPath = pluginsDir.absoluteFilePath(ToQString(vfsDLL));
+ QString vfsDLLPath = qApp->applicationDirPath() + "/" + QString::fromStdWString(vfsDLL);
- qDebug("DLL USVFS Target Path: " + targetPath.toLatin1());
- qDebug("DLL USVFS VFS DLL Path: " + vfsDLLPath.toLatin1());
+ qDebug("DLL USVFS Target Path: " + targetPath.toLatin1());
+ qDebug("DLL USVFS VFS DLL Path: " + vfsDLLPath.toLatin1());
- QFile dllFile(targetPath);
+ QFile dllFile(targetPath);
- if (dllFile.exists()) {
- // may be outdated
- if (!hashIdentical(targetPath, vfsDLLPath)) {
- dllFile.remove();
- }
- }
+ if (dllFile.exists()) {
+ // may be outdated
+ if (!hashIdentical(targetPath, vfsDLLPath)) {
+ dllFile.remove();
+ }
+ }
- if (!dllFile.exists()) {
- // install dll to SE plugins
- if (!QFile::copy(vfsDLLPath, targetPath)) {
- throw MyException(QObject::tr("Failed to copy %1 to %2").arg(vfsDLLPath, targetPath));
- }
- }
+ if (!dllFile.exists()) {
+ // install dll to SE plugins
+ if (!QFile::copy(vfsDLLPath, targetPath)) {
+ throw MyException(QObject::tr("Failed to copy %1 to %2").arg(vfsDLLPath, targetPath));
+ }
+ }
+ }
writeHintFile(pluginsDir);
} catch (const std::exception &e) {
QMessageBox::critical(nullptr, QObject::tr("Failed to set up script extender loading"), e.what());
|
