Manager: only do pathsep localisation on two-way variables
By accident the Manager was performing slash localisation on all command parameters, causing some math expressions for FFmpeg to fail.
This commit is contained in:
parent
3d2bdddffa
commit
0c91fe93d0
@ -87,14 +87,14 @@ func TestReplacePathsWindows(t *testing.T) {
|
|||||||
replacedTask := replaceTaskVariables(&conf, task, worker)
|
replacedTask := replaceTaskVariables(&conf, task, worker)
|
||||||
|
|
||||||
assert.Equal(t,
|
assert.Equal(t,
|
||||||
`s:\flamenco\jobs\sybren\2017-06-08-181223.625800-sybren-flamenco-test.flamenco\flamenco-test.flamenco.blend`,
|
`s:/flamenco/jobs/sybren/2017-06-08-181223.625800-sybren-flamenco-test.flamenco/flamenco-test.flamenco.blend`,
|
||||||
replacedTask.Commands[2].Parameters["filepath"],
|
replacedTask.Commands[2].Parameters["filepath"],
|
||||||
)
|
)
|
||||||
assert.Equal(t,
|
assert.Equal(t,
|
||||||
[]string{"--render-out", `s:\flamenco\render\long\sybren\blender-cloud-addon\flamenco-test__intermediate\render-smpl-0001-0084-frm-######`},
|
[]string{"--render-out", `s:/flamenco/render/long/sybren/blender-cloud-addon/flamenco-test__intermediate/render-smpl-0001-0084-frm-######`},
|
||||||
replacedTask.Commands[2].Parameters["args"],
|
replacedTask.Commands[2].Parameters["args"],
|
||||||
)
|
)
|
||||||
assert.Equal(t, `{hey}\haha`, replacedTask.Commands[2].Parameters["otherpath"])
|
assert.Equal(t, `{hey}/haha`, replacedTask.Commands[2].Parameters["otherpath"])
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReplacePathsUnknownOS(t *testing.T) {
|
func TestReplacePathsUnknownOS(t *testing.T) {
|
||||||
|
@ -435,6 +435,7 @@ func (c *Conf) ExpandVariables(inputChannel <-chan string, outputChannel chan<-
|
|||||||
//
|
//
|
||||||
// Practically, this replaces "value for the Manager platform" with "value
|
// Practically, this replaces "value for the Manager platform" with "value
|
||||||
// for the target platform".
|
// for the target platform".
|
||||||
|
isPathValue := false
|
||||||
for varname, managerValue := range twoWayVars {
|
for varname, managerValue := range twoWayVars {
|
||||||
targetValue, ok := varsForPlatform[varname]
|
targetValue, ok := varsForPlatform[varname]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -444,12 +445,18 @@ func (c *Conf) ExpandVariables(inputChannel <-chan string, outputChannel chan<-
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
expanded = targetValue + expanded[len(managerValue):]
|
expanded = targetValue + expanded[len(managerValue):]
|
||||||
|
|
||||||
|
// Since two-way variables are meant for path replacement, we know this
|
||||||
|
// should be a path.
|
||||||
|
if c.isTwoWay(varname) {
|
||||||
|
isPathValue = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since two-way variables are meant for path replacement, we know this
|
if isPathValue {
|
||||||
// should be a path. For added bonus, translate it to the target platform's
|
expanded = crosspath.ToPlatform(expanded, string(platform))
|
||||||
// path separators.
|
}
|
||||||
return crosspath.ToPlatform(expanded, string(platform))
|
return expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
for valueToExpand := range inputChannel {
|
for valueToExpand := range inputChannel {
|
||||||
@ -505,6 +512,10 @@ func (c *Conf) getVariables(audience VariableAudience, platform VariablePlatform
|
|||||||
return varsForPlatform
|
return varsForPlatform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Conf) isTwoWay(varname string) bool {
|
||||||
|
return c.implicitVariables[varname].IsTwoWay || c.Variables[varname].IsTwoWay
|
||||||
|
}
|
||||||
|
|
||||||
// GetTwoWayVariables returns the two-way variable values for this (audience,
|
// GetTwoWayVariables returns the two-way variable values for this (audience,
|
||||||
// platform) combination. If no variables are found, just returns an empty map.
|
// platform) combination. If no variables are found, just returns an empty map.
|
||||||
// If a value is defined for both the "all" platform and specifically the given
|
// If a value is defined for both the "all" platform and specifically the given
|
||||||
@ -515,8 +526,7 @@ func (c *Conf) GetTwoWayVariables(audience VariableAudience, platform VariablePl
|
|||||||
// Only keep the two-way variables.
|
// Only keep the two-way variables.
|
||||||
twoWayVars := map[string]string{}
|
twoWayVars := map[string]string{}
|
||||||
for varname, value := range varsForPlatform {
|
for varname, value := range varsForPlatform {
|
||||||
isTwoWay := c.implicitVariables[varname].IsTwoWay || c.Variables[varname].IsTwoWay
|
if c.isTwoWay(varname) {
|
||||||
if isTwoWay {
|
|
||||||
twoWayVars[varname] = value
|
twoWayVars[varname] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user