Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,31 @@ private void appendOneNativeArgument(ExecutionContext context, object obj, char
arg = PSObject.ToStringParser(context, ParserOps.Current(null, list));
}

Collection<string> resolvedPaths = new Collection<string>();
if (!String.IsNullOrEmpty(arg))
{
// perform globbing if verbatim marker wasn't specified,
// and there is globbing to be performed
if (!sawVerbatimArgumentMarker
&& LocationGlobber.StringContainsGlobCharacters(arg))
{
Provider.CmdletProvider providerInstance;
ProviderInfo provider;
resolvedPaths =
context.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(
arg, false, out provider, out providerInstance);
}

// either no there was no globbing to perform, or it failed, so add the original argument
if (resolvedPaths.Count == 0)
{
resolvedPaths.Add(arg);
}
}

foreach (string path in resolvedPaths)
{
arg = path;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are cases in the following loop where arg gets modified, so path cannot be used as it's an iterator. So arg = path seemed to be the cleanest solution (and meant not having to rename the variable elsewhere).

if (needSeparator)
{
_arguments.Append(separator);
Expand Down