Browse Source

fix(installer): create profile.ps1 if nonexistent (#2810)

Philipp Bokatius 2 years ago
parent
commit
7fc0d0f72b
1 changed files with 7 additions and 0 deletions
  1. 7 0
      utils/installer/install.ps1

+ 7 - 0
utils/installer/install.ps1

@@ -264,6 +264,13 @@ function create_alias {
         return
     }
 
+    try {
+        Get-Content $PROFILE -ErrorAction Stop
+    }
+    catch {
+        New-Item -Path $PROFILE -ItemType "file" -Force
+    }
+
     Add-Content -Path $PROFILE -Value $("`r`nSet-Alias lvim $lvim_bin")
 
     Write-Host 'To use the new alias in this window reload your profile with: `. $PROFILE`' -ForegroundColor Green