Skip to content

Commit

Permalink
Fix: The content after "=" is recognized as value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bush2021 committed Oct 16, 2023
1 parent dc901c5 commit f17e5f9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Automatically Build Chrome++

on:
workflow_dispatch:
Expand All @@ -17,31 +17,31 @@ jobs:
runs-on: windows-latest

steps:
- name: checkout
- name: Checkout Repo
uses: actions/[email protected]
with:
submodules: 'true'

- name: setup VC-LTL
- name: Setup VC-LTL
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget install VC-LTL

- name: setup xmake
- name: Setup Xmake
uses: xmake-io/github-action-setup-xmake@v1

- name: configure
- name: Configure Xmake
run: xmake f -a ${{ matrix.arch }}

- name: build
- name: Build Chrome++
run: xmake

- name: upload
- name: Upload DLL
uses: actions/[email protected]
with:
name: ${{ matrix.name }}
path: build/release

- name: upload
- name: Upload INI
uses: actions/[email protected]
with:
name: chrome++.ini
Expand Down
Binary file modified src/chrome++.ini
Binary file not shown.
36 changes: 32 additions & 4 deletions src/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,40 @@ std::wstring GetCommand(LPWSTR param)
args.push_back(L"--disable-features=RendererCodeIntegrity,FlashDeprecationWarning");

// 获取命令行,然后追加参数
// 如果存在 = 号,参数会被识别成值
// 修改方法是截取拆分,然后多次 args.push_back
// 首先检测是否存在 =,不存在按照原有方法处理
// 若存在,以匹配到的第一个 = 为中心,向前匹配 -- 为开头,向后匹配空格为结尾,把这整一段提取出来,单独 push_back
// 然后再把提取出来的部分从原有的字符串中删除,再 push_back 剩下的部分
// 重复上述过程,直到字符串中不再存在 = 号
// 这样就可以保证参数不会被识别成值了
{
auto cr_command_line = GetCrCommandLine();

wchar_t temp[MAX_PATH];
wsprintf(temp, L"%s", cr_command_line.c_str());
args.push_back(temp);
std::wstring temp = cr_command_line;
while (true)
{
auto pos = temp.find(L"=");
if (pos == std::wstring::npos)
{
args.push_back(temp);
break;
}
else
{
auto pos1 = temp.rfind(L"--", pos);
auto pos2 = temp.find(L" ", pos);
if (pos1 == std::wstring::npos || pos2 == std::wstring::npos)
{
args.push_back(temp);
break;
}
else
{
args.push_back(temp.substr(pos1, pos2 - pos1));
temp = temp.substr(0, pos1) + temp.substr(pos2);
}
}
}
}

{
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define RELEASE_VER_MAIN 1
#define RELEASE_VER_SUB 5
#define RELEASE_VER_FIX 7
#define RELEASE_VER_FIX 8

#define TOSTRING2(arg) #arg
#define TOSTRING(arg) TOSTRING2(arg)
Expand Down

0 comments on commit f17e5f9

Please sign in to comment.