Create $PROFILE's parent dir if it doesn't exists
This commit is contained in:
parent
90e1723052
commit
e86c7350be
|
@ -169,7 +169,11 @@ Get-Command Reload-MyScripts -ErrorAction SilentlyContinue | ForEach-Object { .
|
||||||
Invoke-ExpressionEx -sudo:$shouldSudo chmod 'a+r' $tmpOutput.FullName
|
Invoke-ExpressionEx -sudo:$shouldSudo chmod 'a+r' $tmpOutput.FullName
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$local:errMsg = $(Invoke-ExpressionEx -sudo:$shouldSudo "Copy-Item $($tmpOutput.FullName) $p -Force:`$$Force -ErrorAction Stop | Out-Null; Remove-Item $($tmpOutput.FullName) -Force:`$$Force -ErrorAction Stop" 2>&1)
|
$local:errMsg = $(Invoke-ExpressionEx -sudo:$shouldSudo @"
|
||||||
|
if( -not (Test-Path $(Split-Path -Parent $p)) ) { New-Item -Type Directory $(Split-Path -Parent $p) -Force };
|
||||||
|
Copy-Item $($tmpOutput.FullName) $p -Force:`$$Force -ErrorAction Stop | Out-Null;
|
||||||
|
Remove-Item $($tmpOutput.FullName) -Force:`$$Force -ErrorAction Stop
|
||||||
|
"@ 2>&1)
|
||||||
if ( $errMsg ) {
|
if ( $errMsg ) {
|
||||||
Write-Error "$errMsg"
|
Write-Error "$errMsg"
|
||||||
$status = $status -replace 'Need ', 'Failed '
|
$status = $status -replace 'Need ', 'Failed '
|
||||||
|
|
Loading…
Reference in New Issue