mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Fix. Msi. Terminate brokers. (#7693)
* Fix. Msi. Terminate brokers. Signed-off-by: fufesou <shuanglongchen@yeah.net> * Fix. Msi, remove tray shortcut in startmenu Signed-off-by: fufesou <shuanglongchen@yeah.net> * Msi. format Signed-off-by: fufesou <shuanglongchen@yeah.net> * Feat. Msi, set property Signed-off-by: fufesou <shuanglongchen@yeah.net> * Fix. Mis, only do InstallValidate if is Install Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
36
res/msi/CustomActions/ReadConfig.cpp
Normal file
36
res/msi/CustomActions/ReadConfig.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <cwctype>
|
||||
|
||||
void trim(std::wstring& str) {
|
||||
str.erase(str.begin(), std::find_if(str.begin(), str.end(), [](wchar_t ch) {
|
||||
return !std::iswspace(ch);
|
||||
}));
|
||||
str.erase(std::find_if(str.rbegin(), str.rend(), [](wchar_t ch) {
|
||||
return !std::iswspace(ch);
|
||||
}).base(), str.end());
|
||||
}
|
||||
|
||||
std::wstring ReadConfig(const std::wstring& filename, const std::wstring& key)
|
||||
{
|
||||
std::wstring configValue;
|
||||
std::wstring line;
|
||||
std::wifstream file(filename);
|
||||
while (std::getline(file, line)) {
|
||||
trim(line);
|
||||
if (line.find(key) == 0) {
|
||||
std::size_t position = line.find(L"=", key.size());
|
||||
if (position != std::string::npos) {
|
||||
configValue = line.substr(position + 1);
|
||||
trim(configValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
return configValue;
|
||||
}
|
||||
Reference in New Issue
Block a user