Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bin] meshroom_batch: Fix input parsing for Windows #2188

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion bin/meshroom_batch
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,30 @@ with multiview.GraphModification(graph):
"""Utility method for parsing the input and inputRecursive arguments."""
mapInputs = {}
for inp in inputs:
inputGroup = inp.split(':')
# Stop after the first occurrence to handle multiple input paths on Windows platforms
inputGroup = inp.split(':', 1)
nodeName = None
if len(inputGroup) == 1 and uniqueInitNode:
nodeName = uniqueInitNode.getName()
elif len(inputGroup) == 2:
# If inputGroup[0] is a valid node name, use it as such.
if (inputGroup[0] in graph.toDict().keys()):
nodeName = inputGroup[0]
# Otherwise, the platform might be Windows and inputGroup[0] is part of the input path:
# in that case, we should behave as if len(inputGroup) == 1, use the uniqueInitNode's name
# and re-join the path together.
elif uniqueInitNode:
nodeName = uniqueInitNode.getName()
inputGroup = [":".join(inputGroup)]
else:
print('Syntax error in input argument')
# If a node name has been provided and the platform is Windows, the length of inputGroup might be
# 3: first the node name, then the first path of the input path, then the rest of the input path.
# The input path should also be re-joined here.
elif len(inputGroup) == 3:
nodeName = inputGroup[0]
inputGroup[1] = ":".join(inputGroup[1:])
inputGroup.pop(-1)
else:
print('Syntax error in input argument')
sys.exit(1)
Expand Down