@@ -10,6 +10,37 @@ param(
1010Set-StrictMode - Version Latest
1111$ErrorActionPreference = " Stop"
1212
13+ # Helper function to create symlink/junction
14+ function New-SymbolicLink {
15+ param (
16+ [string ]$LinkPath ,
17+ [string ]$TargetPath
18+ )
19+
20+ # Remove existing link if it exists
21+ if (Test-Path $LinkPath ) {
22+ $item = Get-Item $LinkPath
23+ if ($item.LinkType -eq " Junction" -or $item.LinkType -eq " SymbolicLink" ) {
24+ $item.Delete ()
25+ } else {
26+ Remove-Item - Path $LinkPath - Recurse - Force
27+ }
28+ }
29+
30+ # Create parent directory if needed
31+ $parentDir = Split-Path - Parent $LinkPath
32+ if (-not (Test-Path $parentDir )) {
33+ New-Item - ItemType Directory - Path $parentDir - Force | Out-Null
34+ }
35+
36+ # Create junction (works cross-platform with PowerShell)
37+ if (Test-Path $TargetPath - PathType Container) {
38+ New-Item - ItemType Junction - Path $LinkPath - Target $TargetPath | Out-Null
39+ } else {
40+ New-Item - ItemType SymbolicLink - Path $LinkPath - Target $TargetPath | Out-Null
41+ }
42+ }
43+
1344# Platform-specific configuration
1445$platformConfig = @ {
1546 ' Switch' = @ {
@@ -45,7 +76,7 @@ Write-Host "Setting up $Platform console extension..." -ForegroundColor Cyan
4576Write-Host " Extension path: $ExtensionPath "
4677
4778# Step 1: Validate extension path
48- Write-Host " `n [1/5 ] Validating extension path..." - ForegroundColor Yellow
79+ Write-Host " `n [1/6 ] Validating extension path..." - ForegroundColor Yellow
4980
5081if (-not (Test-Path $ExtensionPath )) {
5182 throw " Extension path does not exist: $ExtensionPath "
@@ -70,7 +101,7 @@ if (-not (Test-Path $sourceDir)) {
70101Write-Host " ✓ Extension path validated" - ForegroundColor Green
71102
72103# Step 2: Build extension
73- Write-Host " `n [2/5 ] Building extension..." - ForegroundColor Yellow
104+ Write-Host " `n [2/6 ] Building extension..." - ForegroundColor Yellow
74105Write-Host " Running: cmake --workflow --preset $ ( $config.Preset ) --fresh"
75106
76107Push-Location $ExtensionPath
@@ -92,7 +123,7 @@ if (-not (Test-Path $buildOutputDir)) {
92123}
93124
94125# Step 3: Create directory structure in sample project
95- Write-Host " `n [3/5 ] Creating directory structure..." - ForegroundColor Yellow
126+ Write-Host " `n [3/6 ] Creating directory structure..." - ForegroundColor Yellow
96127
97128$targetPluginRoot = Join-Path $repoRoot " sample" " Platforms" $config.PlatformFolder " Plugins" " Sentry"
98129$targetSourceRoot = Join-Path $targetPluginRoot " Source"
@@ -116,7 +147,7 @@ foreach ($dir in $dirsToCreate) {
116147Write-Host " ✓ Directory structure created" - ForegroundColor Green
117148
118149# Step 4: Copy build artifacts (ThirdParty libs/headers)
119- Write-Host " `n [4/5 ] Copying build artifacts..." - ForegroundColor Yellow
150+ Write-Host " `n [4/6 ] Copying build artifacts..." - ForegroundColor Yellow
120151
121152$buildThirdPartyDir = Join-Path $buildOutputDir " Source" " ThirdParty" $config.PlatformFolder
122153if (-not (Test-Path $buildThirdPartyDir )) {
@@ -135,38 +166,7 @@ Write-Host " Copied: ThirdParty/$($config.PlatformFolder)/"
135166Write-Host " ✓ Build artifacts copied" - ForegroundColor Green
136167
137168# Step 5: Symlink source files for live editing
138- Write-Host " `n [5/5] Creating symlinks to source files..." - ForegroundColor Yellow
139-
140- # Helper function to create symlink/junction
141- function New-SymbolicLink {
142- param (
143- [string ]$LinkPath ,
144- [string ]$TargetPath
145- )
146-
147- # Remove existing link if it exists
148- if (Test-Path $LinkPath ) {
149- $item = Get-Item $LinkPath
150- if ($item.LinkType -eq " Junction" -or $item.LinkType -eq " SymbolicLink" ) {
151- $item.Delete ()
152- } else {
153- Remove-Item - Path $LinkPath - Recurse - Force
154- }
155- }
156-
157- # Create parent directory if needed
158- $parentDir = Split-Path - Parent $LinkPath
159- if (-not (Test-Path $parentDir )) {
160- New-Item - ItemType Directory - Path $parentDir - Force | Out-Null
161- }
162-
163- # Create junction (works cross-platform with PowerShell)
164- if (Test-Path $TargetPath - PathType Container) {
165- New-Item - ItemType Junction - Path $LinkPath - Target $TargetPath | Out-Null
166- } else {
167- New-Item - ItemType SymbolicLink - Path $LinkPath - Target $TargetPath | Out-Null
168- }
169- }
169+ Write-Host " `n [5/6] Creating symlinks to source files..." - ForegroundColor Yellow
170170
171171# Symlink .uplugin file
172172$upluginFiles = @ (Get-ChildItem - Path $sourceDir - Filter " *.uplugin" - ErrorAction SilentlyContinue)
@@ -197,5 +197,34 @@ if (Test-Path $privateSourceDir) {
197197
198198Write-Host " ✓ Source files symlinked" - ForegroundColor Green
199199
200+ # Step 6: Symlink config files for live editing
201+ Write-Host " `n [6/6] Creating symlinks to config files..." - ForegroundColor Yellow
202+
203+ $sampleConfigDir = Join-Path $ExtensionPath " unreal" " sample-config"
204+ if (Test-Path $sampleConfigDir ) {
205+ $targetConfigDir = Join-Path $repoRoot " sample" " Platforms" $config.PlatformFolder " Config"
206+
207+ # Ensure Config directory exists
208+ if (-not (Test-Path $targetConfigDir )) {
209+ New-Item - ItemType Directory - Path $targetConfigDir - Force | Out-Null
210+ }
211+
212+ # Symlink platform-specific Engine.ini
213+ $configFile = " $ ( $config.PlatformFolder ) Engine.ini"
214+ $configTarget = Join-Path $sampleConfigDir $configFile
215+
216+ if (Test-Path $configTarget ) {
217+ $configLink = Join-Path $targetConfigDir $configFile
218+ New-SymbolicLink - LinkPath $configLink - TargetPath $configTarget
219+ Write-Host " Linked: Config/$configFile "
220+ } else {
221+ Write-Host " Warning: Config file not found: $configFile " - ForegroundColor Yellow
222+ }
223+
224+ Write-Host " ✓ Config files symlinked" - ForegroundColor Green
225+ } else {
226+ Write-Host " Skipping config symlinking (sample-config directory not found)" - ForegroundColor Gray
227+ }
228+
200229Write-Host " `n ✓ Console extension setup complete!" - ForegroundColor Green
201230Write-Host " `n Target location: $targetPluginRoot " - ForegroundColor Cyan
0 commit comments