Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zhili1208 committed Aug 13, 2015
1 parent 26d1567 commit e2d5b3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/VsConsole/PowerShellHost/PowerShellHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,12 @@ private async Task ExecuteInitScriptsAsync()
if (!string.IsNullOrEmpty(pathToPackage))
{
var toolsPath = Path.Combine(pathToPackage, "tools");
var scriptPath = Path.Combine(toolsPath, PowerShellScripts.Init);

if (Directory.Exists(toolsPath))
{
AddPathToEnvironment(toolsPath);
Runspace.ExecuteScript(toolsPath, PowerShellScripts.Init, package);
Runspace.ExecuteScript(pathToPackage, scriptPath, package);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/VsConsole/PowerShellHost/RunspaceDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,12 @@ public void SetExecutionPolicy(ExecutionPolicy policy, ExecutionPolicyScope scop
// Was passing in IPackage
public void ExecuteScript(string installPath, string scriptPath, PackageIdentity package)
{
string fullPath = Path.Combine(installPath, scriptPath);
if (File.Exists(fullPath))
if (File.Exists(scriptPath))
{
string folderPath = Path.GetDirectoryName(fullPath);
string folderPath = Path.GetDirectoryName(scriptPath);

Invoke(
"$__pc_args=@(); $input|%{$__pc_args+=$_}; & " + PathUtility.EscapePSPath(fullPath) + " $__pc_args[0] $__pc_args[1] $__pc_args[2]; Remove-Variable __pc_args -Scope 0",
"$__pc_args=@(); $input|%{$__pc_args+=$_}; & " + PathUtility.EscapePSPath(scriptPath) + " $__pc_args[0] $__pc_args[1] $__pc_args[2]; Remove-Variable __pc_args -Scope 0",
new object[] { installPath, folderPath, package },
outputResults: true);
}
Expand Down

0 comments on commit e2d5b3b

Please sign in to comment.