Skip to content

Commit

Permalink
Update WeaselSetup.cpp: automatically select WeaselDeployer.exe or x6…
Browse files Browse the repository at this point in the history
…4/WeaselDeployer.exe for deployment, when change user dir.
  • Loading branch information
fxliang committed Sep 22, 2023
1 parent e249414 commit 48a2487
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions WeaselSetup/WeaselSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "resource.h"
#include <thread>
#include <WeaselUtility.h>

#include "InstallOptionsDlg.h"

Expand Down Expand Up @@ -136,11 +137,19 @@ static int CustomInstall(bool installing)
{
std::wstring dir(install_dir());
std::thread th([dir]() {
if (is_wow64() && IfFileExistW(dir + L"\\x64\\WeaselDeployer.exe") && IfFileExistW(dir + L"\\x64\\rime.dll")) {
ShellExecuteW(NULL, NULL, (dir + L"\\WeaselServer.exe").c_str(), L"/q", NULL, SW_SHOWNORMAL);
Sleep(500);
ShellExecuteW(NULL, NULL, (dir + L"\\WeaselServer.exe").c_str(), L"", NULL, SW_SHOWNORMAL);
Sleep(500);
ShellExecuteW(NULL, NULL, (dir + L"\\x64\\WeaselDeployer.exe").c_str(), L"/deploy", NULL, SW_SHOWNORMAL);
} else {
ShellExecuteW(NULL, NULL, (dir + L"\\WeaselServer.exe").c_str(), L"/q", NULL, SW_SHOWNORMAL);
Sleep(500);
ShellExecuteW(NULL, NULL, (dir + L"\\WeaselServer.exe").c_str(), L"", NULL, SW_SHOWNORMAL);
Sleep(500);
ShellExecuteW(NULL, NULL, (dir + L"\\WeaselDeployer.exe").c_str(), L"/deploy", NULL, SW_SHOWNORMAL);
}
});
th.detach();
MSG_BY_IDS(IDS_STR_MODIFY_SUCCESS_INFO, IDS_STR_MODIFY_SUCCESS_CAP, MB_ICONINFORMATION | MB_OK);
Expand Down

0 comments on commit 48a2487

Please sign in to comment.