Skip to content

Commit

Permalink
fix: Read all argvs
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Aug 29, 2024
1 parent 7fb6548 commit f33255f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/main/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,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
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

0 comments on commit f33255f

Please sign in to comment.