Fix launcher paths and remove local hardcoding
This commit is contained in:
1 parent
e7a7d3f888
commit
13b1f2150c
15 files changed
+145
-66
No files matched your search
@@ -4,10 +4,39 @@
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Switch to project directory
|
||||
$projectPath = "C:\Users\12742\Desktop\douyin_guaji-main"
|
||||
# Switch to project directory (parent of this scripts directory)
|
||||
$projectPath = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||
Set-Location $projectPath
|
||||
|
||||
function Ensure-GitOnPath {
|
||||
if (Get-Command git -ErrorAction SilentlyContinue) {
|
||||
return
|
||||
}
|
||||
|
||||
$candidateDirs = @(
|
||||
"C:\Program Files\Git\cmd",
|
||||
"C:\Program Files\Git\bin",
|
||||
"C:\Program Files (x86)\Git\cmd",
|
||||
"C:\Program Files (x86)\Git\bin",
|
||||
(Join-Path $env:LOCALAPPDATA "Programs\Git\cmd"),
|
||||
(Join-Path $env:LOCALAPPDATA "Programs\Git\bin"),
|
||||
"C:\ProgramData\chocolatey\bin"
|
||||
)
|
||||
|
||||
foreach ($dir in $candidateDirs) {
|
||||
if ($dir -and (Test-Path -LiteralPath (Join-Path $dir "git.exe"))) {
|
||||
$env:Path = "$dir;$env:Path"
|
||||
if (Get-Command git -ErrorAction SilentlyContinue) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw "Git executable not found. Please install Git or add git.exe to PATH."
|
||||
}
|
||||
|
||||
Ensure-GitOnPath
|
||||
|
||||
# Get current timestamp
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
|
||||
@@ -49,4 +78,3 @@ try {
|
||||
Write-Host "Stack trace: $($_.ScriptStackTrace)" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user