Skip to content

Commit

Permalink
Append relative path to the vsix file to the source for recursive sea…
Browse files Browse the repository at this point in the history
…rches (#20)
  • Loading branch information
Derek Smith authored and madskristensen committed Jan 28, 2020
1 parent d30d58d commit ed2be82
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,28 @@ private static Package ProcessVsix(string sourceVsixPath)
ZipFile.ExtractToDirectory(sourceVsixPath, tempFolder);

var vsixFile = Path.GetFileName(sourceVsixPath);
var vsixSourcePath = string.IsNullOrEmpty(_source) ? sourceVsixPath : Path.Combine(_source, vsixFile);

string alternateDestination = Path.Combine(_source, vsixFile);

// Append the relative path to source
if (_recursive)
{
string subFolder = sourceVsixPath.Substring(_dir.Length);

alternateDestination = Path.Combine(_source, subFolder);

if (Uri.IsWellFormedUriString(_source, UriKind.RelativeOrAbsolute))
{
UriBuilder uriBuilder = new UriBuilder(_source);

uriBuilder.Path = alternateDestination;

alternateDestination = uriBuilder.Uri.ToString();
}
}

var vsixSourcePath = string.IsNullOrEmpty(_source) ? sourceVsixPath : alternateDestination;

var parser = new VsixManifestParser();
Package package = parser.CreateFromManifest(tempFolder, vsixFile, vsixSourcePath);

Expand Down

0 comments on commit ed2be82

Please sign in to comment.