Skip to content

Commit

Permalink
fix: Fix alias -i
Browse files Browse the repository at this point in the history
  • Loading branch information
mrseanryan committed Jan 17, 2020
1 parent 8c736d6 commit a33c4d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function launchChocolateBarsApp() {
const electronArgs = [
// MUST align with SharedDataUtils.ts and ImageSizeExecutor.ts:
appPath,
...process.argv.filter(a => !a.startsWith("--imageDir")),
...process.argv,
`--imageDir=${ArgsParser.encodeSpaces(parsedArgs.imageDir)}`
];

Expand Down
7 changes: 6 additions & 1 deletion src/utils/SharedDataUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ export namespace SharedDataUtils {
export function getArgs(): ChocolateBarsArgs {
const args = remote.getGlobal("sharedObject") as ChocolateBarsArgs;

args.imageDir = ArgsParser.decodeSpaces(args.imageDir);
args.imageDir = ArgsParser.decodeSpaces(ensureIsString(args.imageDir));

return args;
}

// With cli usage of '-i', the encoded imageDir appears twice, so we get an array
function ensureIsString(imageDir: string | string[]): string {
return Array.isArray(imageDir) ? imageDir[imageDir.length - 1] : imageDir;
}
}

0 comments on commit a33c4d4

Please sign in to comment.