File tree Expand file tree Collapse file tree 3 files changed +36
-27
lines changed Expand file tree Collapse file tree 3 files changed +36
-27
lines changed Original file line number Diff line number Diff line change 64
64
Function Test-IsISE {
65
65
# try...catch accounts for:
66
66
# Set-StrictMode -Version latest
67
- try {
68
- return $psISE -ne $null ;
69
- }
70
- catch {
71
- return $false ;
72
- }
67
+ try {
68
+ return $psISE -ne $null ;
73
69
}
74
-
70
+ catch {
71
+ return $false ;
72
+ }
73
+ }
74
+
75
75
Function Get-ScriptPath {
76
+ If (Test-Path - LiteralPath ' variable:HostInvocation' ) { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
77
+
76
78
# Makes debugging from ISE easier.
77
79
if ($PSScriptRoot -eq " " )
78
80
{
@@ -90,8 +92,9 @@ Function Get-ScriptPath {
90
92
}
91
93
else
92
94
{
93
- # $root = $PSScriptRoot
94
- $MyInvocation.MyCommand.Path
95
+ # $PSScriptRoot
96
+ $PSCommandPath
97
+ # $MyInvocation.MyCommand.Path
95
98
}
96
99
}
97
100
Original file line number Diff line number Diff line change 161
161
Function Test-IsISE {
162
162
# try...catch accounts for:
163
163
# Set-StrictMode -Version latest
164
- try {
165
- return $psISE -ne $null ;
166
- }
167
- catch {
168
- return $false ;
169
- }
164
+ try {
165
+ return $psISE -ne $null ;
170
166
}
171
-
167
+ catch {
168
+ return $false ;
169
+ }
170
+ }
171
+
172
172
Function Get-ScriptPath {
173
+ If (Test-Path - LiteralPath ' variable:HostInvocation' ) { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
174
+
173
175
# Makes debugging from ISE easier.
174
176
if ($PSScriptRoot -eq " " )
175
177
{
@@ -187,8 +189,9 @@ Function Get-ScriptPath {
187
189
}
188
190
else
189
191
{
190
- # $root = $PSScriptRoot
191
- $MyInvocation.MyCommand.Path
192
+ # $PSScriptRoot
193
+ $PSCommandPath
194
+ # $MyInvocation.MyCommand.Path
192
195
}
193
196
}
194
197
Original file line number Diff line number Diff line change 57
57
Function Test-IsISE {
58
58
# try...catch accounts for:
59
59
# Set-StrictMode -Version latest
60
- try {
61
- return $psISE -ne $null ;
62
- }
63
- catch {
64
- return $false ;
65
- }
60
+ try {
61
+ return $psISE -ne $null ;
66
62
}
67
-
63
+ catch {
64
+ return $false ;
65
+ }
66
+ }
67
+
68
68
Function Get-ScriptPath {
69
+ If (Test-Path - LiteralPath ' variable:HostInvocation' ) { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
70
+
69
71
# Makes debugging from ISE easier.
70
72
if ($PSScriptRoot -eq " " )
71
73
{
@@ -83,8 +85,9 @@ Function Get-ScriptPath {
83
85
}
84
86
else
85
87
{
86
- # $root = $PSScriptRoot
87
- $MyInvocation.MyCommand.Path
88
+ # $PSScriptRoot
89
+ $PSCommandPath
90
+ # $MyInvocation.MyCommand.Path
88
91
}
89
92
}
90
93
You can’t perform that action at this time.
0 commit comments