Skip to content

Commit 00133f1

Browse files
authored
Merge pull request #2188 from alicevision/fix/batchParsingWindows
[bin] `meshroom_batch`: Fix input parsing for Windows
2 parents 09c3c10 + 07a9f8a commit 00133f1

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

bin/meshroom_batch

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,30 @@ with multiview.GraphModification(graph):
106106
"""Utility method for parsing the input and inputRecursive arguments."""
107107
mapInputs = {}
108108
for inp in inputs:
109-
inputGroup = inp.split(':')
109+
# Stop after the first occurrence to handle multiple input paths on Windows platforms
110+
inputGroup = inp.split(':', 1)
110111
nodeName = None
111112
if len(inputGroup) == 1 and uniqueInitNode:
112113
nodeName = uniqueInitNode.getName()
113114
elif len(inputGroup) == 2:
115+
# If inputGroup[0] is a valid node name, use it as such.
116+
if (inputGroup[0] in graph.toDict().keys()):
117+
nodeName = inputGroup[0]
118+
# Otherwise, the platform might be Windows and inputGroup[0] is part of the input path:
119+
# in that case, we should behave as if len(inputGroup) == 1, use the uniqueInitNode's name
120+
# and re-join the path together.
121+
elif uniqueInitNode:
122+
nodeName = uniqueInitNode.getName()
123+
inputGroup = [":".join(inputGroup)]
124+
else:
125+
print('Syntax error in input argument')
126+
# If a node name has been provided and the platform is Windows, the length of inputGroup might be
127+
# 3: first the node name, then the first path of the input path, then the rest of the input path.
128+
# The input path should also be re-joined here.
129+
elif len(inputGroup) == 3:
114130
nodeName = inputGroup[0]
131+
inputGroup[1] = ":".join(inputGroup[1:])
132+
inputGroup.pop(-1)
115133
else:
116134
print('Syntax error in input argument')
117135
sys.exit(1)

0 commit comments

Comments
 (0)