b490e463b0
run.ps1과 test.ps1이 %LOCALAPPDATA%\Programs\Godot 한 곳만 보고 있어서 다른 데 설치하면 "Godot을 찾을 수 없습니다"로 끝났다. find-godot.ps1을 두어 GODOT_BIN 환경 변수 → 알려진 설치 폴더들(바탕화면·다운로드 포함) → PATH 순으로 찾고, 필요한 판(콘솔/일반)을 가려 쓰게 했다. 이름으로 훑기 때문에 버전이 올라가도 잡힌다. 클론 직후에는 .godot이 없어 class_name이 등록되지 않는다. 그 상태로 실행하면 game_state.gd 파싱이 실패해 오토로드가 통째로 죽으므로, 두 스크립트가 먼저 --import를 한 번 돌린다. 세 파일 모두 UTF-8 BOM으로 저장했다. BOM이 없으면 Windows PowerShell 5.1이 cp949로 읽어 한글 메시지가 깨진다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uze4mF1NAGfFRio77cMFqg
21 lines
924 B
PowerShell
21 lines
924 B
PowerShell
# 에디터 없이 게임만 바로 실행합니다. 사용: 우클릭 > PowerShell로 실행, 또는 .\run.ps1
|
|
$godot = & "$PSScriptRoot\find-godot.ps1"
|
|
if (-not $godot) {
|
|
Write-Error "Godot 4를 찾을 수 없습니다. 실행 파일 경로를 GODOT_BIN 환경 변수에 넣어 주세요."
|
|
exit 1
|
|
}
|
|
|
|
# 클론 직후엔 .godot이 없다. 한 번 가져와야 class_name이 등록되고 스크립트가 뜬다.
|
|
if (-not (Test-Path "$PSScriptRoot\.godot")) {
|
|
Write-Host "첫 실행입니다. 프로젝트를 가져오는 중..."
|
|
$importer = & "$PSScriptRoot\find-godot.ps1" -Console
|
|
if (-not $importer) { $importer = $godot }
|
|
& $importer --headless --import --path $PSScriptRoot
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error "가져오기에 실패했습니다."
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
Start-Process -FilePath $godot -ArgumentList @("--path", $PSScriptRoot) -WorkingDirectory $PSScriptRoot
|