Allow path separator in scene filename parser pattern (#327)

* Allow path in filename parser

* Fix helper text re escaping {} characters
This commit is contained in:
WithoutPants
2020-01-25 14:34:01 +11:00
committed by Leopere
parent 5a5f42f061
commit c83eb098bc
2 changed files with 9 additions and 3 deletions

View File

@@ -335,9 +335,15 @@ func (h *sceneHolder) postParse() {
}
func (m parseMapper) parse(scene *models.Scene) *sceneHolder {
// perform matching on basename
// TODO - may want to handle full path at some point
// #302 - if the pattern includes a path separator, then include the entire
// scene path in the match. Otherwise, use the default behaviour of just
// the file's basename
// must be double \ because of the regex escaping
filename := filepath.Base(scene.Path)
if strings.Contains(m.regexString, `\\`) || strings.Contains(m.regexString, "/") {
filename = scene.Path
}
result := m.regex.FindStringSubmatch(filename)

View File

@@ -694,7 +694,7 @@ export const SceneFilenameParser: FunctionComponent<IProps> = (props: IProps) =>
<FormGroup
label="Filename pattern:"
inline={true}
helperText="Use '\\' to escape literal {} characters"
helperText="Use '\' to escape literal {} characters"
>
<InputGroup
onChange={(newValue: any) => setPattern(newValue.target.value)}