Skip to content

Commit aeba481

Browse files
committed
2.2.7 update
1 parent a17a9f6 commit aeba481

File tree

12 files changed

+86
-22
lines changed

12 files changed

+86
-22
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## 2.2.7 - 2017-11-10
5+
6+
### Added
7+
8+
* Executable modifier field is now available. Now you can modify executable, append/prepend custom data.
9+
10+
### Changed
11+
12+
* Default initial page changed to `Parsers`.
13+
* Arguments are now appended to executable by default.
14+
* A lot of fields are now trimmed for whitespace.
15+
16+
### Fixed
17+
18+
* Added missing and fixed incorrect whitespace validation.
19+
420
## 2.2.6 - 2017-11-09
521

622
### Added

src/lang/english/langData.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ export const EnglishLang: languageContainer = {
211211
require('./markdown/what-is-app-id.md'),
212212
require('./markdown/parser-variables.md')
213213
],
214+
executableModifier: [
215+
require('./markdown/executable-modifier.md'),
216+
require('./markdown/what-is-app-id.md'),
217+
require('./markdown/parser-variables.md')
218+
],
214219
titleFromVariable: [
215220
require('./markdown/title-from-variable.md')
216221
],
@@ -282,6 +287,7 @@ export const EnglishLang: languageContainer = {
282287
parserType: 'Parser type',
283288
configTitle: 'Configuration title',
284289
steamCategory: 'Steam category',
290+
executableModifier: 'Executable modifier',
285291
executableLocation: 'Executable',
286292
romDirectory: 'ROMs directory',
287293
steamDirectory: 'Steam directory',
@@ -336,6 +342,7 @@ export const EnglishLang: languageContainer = {
336342
executable__md: '> Executable file is invalid!',
337343
imagePool__md: '> Image pool must not be empty!',
338344
titleModifier__md: '> Title modifier must not be empty!',
345+
executableModifier__md: '> Executable modifier must not be empty!',
339346
variableString__md: '> Uneven number of `${` and `}` pairs. Use `\\` to escape `${` or `}` if you want to use them as characters.',
340347
imageProviders__md: '> Incorrect image providers type!',
341348
unhandledValidationKey__md: '> Input\'s validation is unhandled'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Executable modifier `[supports variables]`{.noWrap}
2+
3+
Default value is `"${exePath}"`{.noWrap}. This setting can be used to prepend or append desired characters to an executable which will be added to Steam (`Target` property). For example, given that `${exePath}`{.noWrap} is `C:\RetroArch\retroarch.exe`, you can add `"cmd" /k start /min` to it by setting value to:
4+
```
5+
"cmd" /k start /min "${exePath}"
6+
```
7+
You can use any other variable to construct the final executable.
8+
9+
This setting influences Steam's APP ID.

src/lib/file-parser.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export class FileParser {
159159
parsedConfigs[i].files.push({
160160
steamCategories: undefined,
161161
executableLocation: executableLocation,
162+
modifiedExecutableLocation: undefined,
162163
startInDirectory: configs[i].startInDirectory.length > 0 ? configs[i].startInDirectory : path.dirname(executableLocation),
163164
argumentString: undefined,
164165
resolvedLocalImages: [],
@@ -177,23 +178,26 @@ export class FileParser {
177178
let variableData = this.makeVariableData(configs[i], lastFile);
178179

179180
lastFile.finalTitle = vParser.setInput(configs[i].titleModifier).parse() ? vParser.replaceVariables((variable) => {
180-
return this.getVariable(variable as AllVariables, variableData);
181-
}) : '';
181+
return this.getVariable(variable as AllVariables, variableData).trim();
182+
}) : undefined;
182183

183184
variableData.finalTitle = lastFile.finalTitle;
184185

185186
lastFile.argumentString = vParser.setInput(configs[i].executableArgs).parse() ? vParser.replaceVariables((variable) => {
186-
return this.getVariable(variable as AllVariables, variableData);
187-
}) : '';
187+
return this.getVariable(variable as AllVariables, variableData).trim();
188+
}) : undefined;
188189
lastFile.imagePool = vParser.setInput(configs[i].imagePool).parse() ? vParser.replaceVariables((variable) => {
189-
return this.getVariable(variable as AllVariables, variableData);
190-
}) : '';
190+
return this.getVariable(variable as AllVariables, variableData).trim();
191+
}) : undefined;
192+
lastFile.modifiedExecutableLocation = vParser.setInput(configs[i].executableModifier).parse() ? vParser.replaceVariables((variable) => {
193+
return this.getVariable(variable as AllVariables, variableData).trim();
194+
}) : undefined;
191195
lastFile.onlineImageQueries = vParser.setInput(configs[i].onlineImageQueries).parse() ? _.uniq(vParser.extractVariables((variable) => {
192196
return this.getVariable(variable as AllVariables, variableData);
193-
})) : [];
197+
})) : undefined;
194198
lastFile.steamCategories = vParser.setInput(configs[i].steamCategory).parse() ? _.uniq(vParser.extractVariables((variable) => {
195199
return this.getVariable(variable as AllVariables, variableData);
196-
})) : [];
200+
})) : undefined;
197201
}
198202

199203
localImagePromises.push(this.resolveFieldGlobs('localImages', configs[i], parsedConfigs[i], vParser).then((data) => {

src/models/language.model.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export interface languageStruct {
187187
startInDirectory: string[],
188188
userAccounts: string[],
189189
titleModifier: string[],
190+
executableModifier: string[],
190191
titleFromVariable: string[],
191192
fuzzyMatch: string[],
192193
executableArgs: string[],
@@ -236,6 +237,7 @@ export interface languageStruct {
236237
configTitle: string,
237238
steamCategory: string,
238239
executableLocation: string,
240+
executableModifier: string,
239241
romDirectory: string,
240242
steamDirectory: string,
241243
startInDirectory: string,
@@ -289,6 +291,7 @@ export interface languageStruct {
289291
executable__md: string
290292
imagePool__md: string,
291293
titleModifier__md: string,
294+
executableModifier__md: string,
292295
variableString__md: string,
293296
imageProviders__md: string,
294297
unhandledValidationKey__md: string

src/models/parser.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { userAccountData } from './steam-id-helpers.model';
22

33
export interface ParsedUserConfigurationFile {
44
executableLocation: string,
5+
modifiedExecutableLocation: string,
56
startInDirectory: string,
67
filePath: string,
78
extractedTitle: string,

src/models/user-configuration.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface UserConfiguration {
33
configTitle: string,
44
steamCategory: string,
55
executableLocation: string,
6+
executableModifier: string,
67
romDirectory: string,
78
steamDirectory: string,
89
startInDirectory: string,

src/renderer/components/parsers.component.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ export class ParsersComponent implements AfterViewInit, OnDestroy {
104104
this.currentDoc.content = this.lang.docs__md.executableLocation.join('');
105105
}
106106
}),
107+
executableModifier: new NestedFormElement.Input({
108+
isHidden: () => this.isHiddenMode(),
109+
highlight: this.highlight.bind(this),
110+
label: this.lang.label.executableModifier,
111+
onValidate: (self, path) => this.parsersService.validate(path[0] as keyof UserConfiguration, self.value),
112+
onInfoClick: (self, path) => {
113+
this.currentDoc.activePath = path.join();
114+
this.currentDoc.content = this.lang.docs__md.executableModifier.join('');
115+
}
116+
}),
107117
romDirectory: new NestedFormElement.Path({
108118
directory: true,
109119
label: this.lang.label.romDirectory,
@@ -244,6 +254,7 @@ export class ParsersComponent implements AfterViewInit, OnDestroy {
244254
executableArgs: new NestedFormElement.Input({
245255
label: this.lang.label.executableArgs,
246256
highlight: this.highlight.bind(this),
257+
onValidate: (self, path) => this.parsersService.validate(path[0] as keyof UserConfiguration, self.value),
247258
onInfoClick: (self, path) => {
248259
this.currentDoc.activePath = path.join();
249260
this.currentDoc.content = this.lang.docs__md.executableArgs.join('');
@@ -487,7 +498,7 @@ export class ParsersComponent implements AfterViewInit, OnDestroy {
487498
success(this.lang.success.completeShortcut__i.interpolate({
488499
index: i + 1,
489500
total: totalLength,
490-
shortcut: `"${data.files[i].executableLocation}" ${data.files[i].argumentString}`
501+
shortcut: `${data.files[i].modifiedExecutableLocation} ${data.files[i].argumentString}`.trim()
491502
}));
492503
if (data.files[i].steamCategories.length > 0) {
493504
success(this.lang.success.steamCategory__i.interpolate({

src/renderer/schemas/user-configuration.schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const userConfiguration = {
99
configTitle: { type: 'string', default: '' },
1010
steamCategory: { type: 'string', default: '' },
1111
executableLocation: { type: 'string', default: '' },
12+
executableModifier: { type: 'string', default: '"${exePath}"' },
1213
romDirectory: { type: 'string', default: '' },
1314
steamDirectory: { type: 'string', default: '' },
1415
startInDirectory: { type: 'string', default: '' },
@@ -42,7 +43,7 @@ export const userConfiguration = {
4243
}
4344
},
4445
executableArgs: { type: 'string', default: '' },
45-
appendArgsToExecutable: { type: 'boolean', default: false },
46+
appendArgsToExecutable: { type: 'boolean', default: true },
4647
imagePool: { type: 'string', default: '${fuzzyTitle}' },
4748
localImages: { type: 'string', default: '' },
4849
localIcons: { type: 'string', default: '' },

src/renderer/services/parsers.service.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,18 @@ export class ParsersService {
198198
return this.lang.validationErrors.parserInput.incorrectParser;
199199
}
200200
case 'titleModifier':
201-
return data ? this.validateVariableParserString(data || '') : this.lang.validationErrors.titleModifier__md;
201+
return this.validateVariableParserString(data || '', this.lang.validationErrors.titleModifier__md);
202+
case 'executableModifier':
203+
return this.validateVariableParserString(data || '', this.lang.validationErrors.executableModifier__md);
202204
case 'titleFromVariable':
203205
return this.validateVariableParserString(data ? data.limitToGroups || '' : '');
204206
case 'onlineImageQueries':
207+
case 'executableArgs':
205208
return this.validateVariableParserString(data || '');
206209
case 'imageProviders':
207210
return _.isArray(data) ? null : this.lang.validationErrors.imageProviders__md;
208211
case 'imagePool':
209-
return data ? this.validateVariableParserString(data || '') : this.lang.validationErrors.imagePool__md;
212+
return this.validateVariableParserString(data || '', this.lang.validationErrors.imagePool__md);
210213
case 'localImages':
211214
case 'localIcons':
212215
return this.fileParser.validateFieldGlob(data || '');
@@ -215,11 +218,16 @@ export class ParsersService {
215218
}
216219
}
217220

218-
private validateVariableParserString(input: string) {
219-
if (input.length === 0 || VariableParser.isValidString('${', '}', input))
220-
return null;
221+
private validateVariableParserString(input: string, emptyError?: string) {
222+
let canBeEmpty = emptyError == undefined;
223+
224+
if (!canBeEmpty)
225+
input = input.trim();
226+
227+
if (canBeEmpty || (!canBeEmpty && input.length > 0))
228+
return VariableParser.isValidString('${', '}', input) ? null : this.lang.validationErrors.variableString__md;
221229
else
222-
return this.lang.validationErrors.variableString__md;
230+
return emptyError;
223231
}
224232

225233
private validatePath(fsPath: string, checkForDirectory: boolean) {
@@ -234,9 +242,10 @@ export class ParsersService {
234242
isConfigurationValid(config: UserConfiguration) {
235243
let simpleValidations: string[] = [
236244
'parserType', 'configTitle', 'steamCategory',
237-
'executableLocation', 'romDirectory', 'steamDirectory',
238-
'specifiedAccounts', 'onlineImageQueries', 'titleModifier',
239-
'imageProviders', 'startInDirectory', 'titleFromVariable',
245+
'executableLocation', 'executableModifier', 'romDirectory',
246+
'steamDirectory', 'startInDirectory', 'specifiedAccounts',
247+
'titleFromVariable', 'titleModifier', 'executableArgs',
248+
'onlineImageQueries', 'imagePool', 'imageProviders',
240249
'localImages', 'localIcons'
241250
];
242251

0 commit comments

Comments
 (0)