Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Read all argvs #51

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build:renderer": "cd ./packages/renderer && vite build",
"build:shared": "cd ./packages/shared && vite build",
"compile": "cross-env MODE=production npm run build && electron-builder build --config electron-builder.yml --dir",
"compile:installer": "cross-env MODE=production npm run build && electron-builder build --config electron-builder.yml",
"compile:installer": "cross-env MODE=production npm run build && electron-builder build --config electron-builder.yml --publish never",
"test": "npm run test:main && npm run test:preload && npm run test:renderer && npm run test:e2e",
"test:e2e": "npm run build && vitest run",
"test:main": "vitest run -r packages/main --passWithNoTests",
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export function isAppUpdated(appPath: string, version: string): boolean {
export function getAdditionalArguments(): string[] {
const args = [];

if (process.argv.length > 2) {
for (let i = 2; i < process.argv.length; i++) {
if (process.argv.length > 0) {
for (let i = 0; i < process.argv.length; i++) {
const arg = process.argv[i];
if (/--(version|prerelease|dev|downloadedfilepath)/.test(arg)) {
args.push(arg);
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/modules/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export async function launchExplorer(event: Electron.IpcMainInvokeEvent, version

if (!fs.existsSync(explorerBinPath)) {
const errorMessage = version ? `The explorer version specified: ${version} is not installed.` : 'The explorer is not installed.';
log.error(`[Main Window][IPC][LaunchExplorer] ${errorMessage}`);
log.error(`[Main Window][IPC][LaunchExplorer] ${errorMessage}`, explorerBinPath);
event.sender.send(IPC_EVENTS.LAUNCH_EXPLORER, {
type: IPC_EVENT_DATA_TYPE.ERROR,
error: errorMessage,
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/modules/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export function initProtocol() {
}

app.whenReady().then(() => {
if (process.argv.length >= 2) {
const url = process.argv.slice(1).find(arg => arg.startsWith(`${PROTOCOL}://`));
if (process.argv.length > 0) {
const url = process.argv.find(arg => arg.startsWith(`${PROTOCOL}://`));
if (url) {
handleProtocol(url);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/preload/src/argvs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export function isValidVersion(version: string): boolean {
export function parseArgv(): Record<string, string> {
const parsedArgv: Record<string, string> = {};

if (process.argv.length > 2) {
for (let i = 2; i < process.argv.length; i++) {
if (process.argv.length > 0) {
for (let i = 0; i < process.argv.length; i++) {
const arg = process.argv[i];
if (/--(version|prerelease|dev|downloadedfilepath)/.test(arg)) {
const [key, value] = arg.split('=');
Expand Down