瀏覽代碼

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

Philipp Bokatius 2 年之前
父節點
當前提交
7fc0d0f72b
共有 1 個文件被更改,包括 7 次插入0 次删除
  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