mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-09 00:24:34 +00:00
fix(windows): handle null Path when running install.ps1 via irm | iex
When running via 'irm ccs.kaitran.ca/install.ps1 | iex', the script executes in-memory without a file path, causing $MyInvocation.MyCommand.Path to be null. This fix checks for null before calling Split-Path to avoid the error: 'Cannot bind argument to parameter Path because it is null' Resolves standalone installation method detection for piped execution.
This commit is contained in:
+12
-2
@@ -13,8 +13,18 @@ $ClaudeDir = "$env:USERPROFILE\.claude"
|
||||
$GlmModel = "glm-4.6"
|
||||
|
||||
# Detect if running from git repository or standalone
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$InstallMethod = if (Test-Path "$ScriptDir\ccs.ps1") { "git" } else { "standalone" }
|
||||
$ScriptDir = if ($MyInvocation.MyCommand.Path) {
|
||||
Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
} else {
|
||||
# Running via irm | iex (in-memory, no file path)
|
||||
$null
|
||||
}
|
||||
|
||||
$InstallMethod = if ($ScriptDir -and (Test-Path "$ScriptDir\ccs.ps1")) {
|
||||
"git"
|
||||
} else {
|
||||
"standalone"
|
||||
}
|
||||
|
||||
# Helper Functions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user