mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-03 01:44:42 +08:00
[*] Fix electron launch args
Summary: We were doing some incorrect processing of args passed to the main function which was causing us to think we were launching NM by passing a file (which creates a new draft and tries to attach that file). Since were trying to attach 'packages/client-app', this was causing an error dialogue to appear indicating that it wasn't possible to attach a directory. Test Plan: Run locally, verify no dialogue Reviewers: evan, spang, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3962
This commit is contained in:
parent
c4a26e1dcd
commit
a95ca8b07a
1 changed files with 5 additions and 4 deletions
|
@ -93,15 +93,15 @@ const parseCommandLine = (argv) => {
|
||||||
const specDirectory = args['spec-directory'];
|
const specDirectory = args['spec-directory'];
|
||||||
const specFilePattern = args['spec-file-pattern'];
|
const specFilePattern = args['spec-file-pattern'];
|
||||||
const showSpecsInWindow = specMode === "window";
|
const showSpecsInWindow = specMode === "window";
|
||||||
const resourcePath = path.resolve(args['resource-path'] != null ? args['resource-path'] : path.dirname(path.dirname(__dirname)));
|
const resourcePath = path.resolve(path.dirname(path.dirname(__dirname)));
|
||||||
const urlsToOpen = [];
|
const urlsToOpen = [];
|
||||||
const pathsToOpen = [];
|
const pathsToOpen = [];
|
||||||
|
|
||||||
// On Windows and Linux, mailto and file opens are passed in argv. Go through
|
// On Windows and Linux, mailto and file opens are passed in argv. Go through
|
||||||
// the items and pluck out things that look like mailto:, nylas:, file paths
|
// the items and pluck out things that look like mailto:, nylas:, file paths
|
||||||
let ignoreNext = false;
|
let ignoreNext = false;
|
||||||
for (let i = 1; i < argv.length; i ++) {
|
// args._ is all of the non-hyphenated options.
|
||||||
const arg = argv[i];
|
for (const arg of args._) {
|
||||||
if (ignoreNext) {
|
if (ignoreNext) {
|
||||||
ignoreNext = false;
|
ignoreNext = false;
|
||||||
continue;
|
continue;
|
||||||
|
@ -110,7 +110,8 @@ const parseCommandLine = (argv) => {
|
||||||
ignoreNext = true;
|
ignoreNext = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg === resourcePath) {
|
// Skip the argument if it's part of the main electron invocation.
|
||||||
|
if (path.resolve(arg) === resourcePath) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg.startsWith('mailto:') || arg.startsWith('nylas:')) {
|
if (arg.startsWith('mailto:') || arg.startsWith('nylas:')) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue