Skip to content

Commit 4814655

Browse files
committed
style: fix scripts
1 parent fdab3ed commit 4814655

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

setup-symlinks.ps1

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
---
2-
# PowerShell script for Windows to create symlinks
1+
# PowerShell script for Windows to create symlinks
32
# Requires Developer Mode enabled OR running PowerShell as Administrator
43

54
$ErrorActionPreference = "Stop"
65
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
76
$sampleUnity6Assets = Join-Path $scriptDir "sample-unity6\Assets"
87

9-
Write-Host "Setting up symlinks for sample-unity6..." -ForegroundColor Cyan
8+
Write-Output "Setting up symlinks for sample-unity6..."
109

1110
# Check if running with sufficient privileges
1211
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
1312
$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
1413

1514
if (-not $isAdmin) {
16-
Write-Host "WARNING: Not running as Administrator." -ForegroundColor Yellow
17-
Write-Host "If symlink creation fails, either:" -ForegroundColor Yellow
18-
Write-Host " 1. Enable Developer Mode (Settings > Update & Security > For developers)" -ForegroundColor Yellow
19-
Write-Host " 2. Run PowerShell as Administrator" -ForegroundColor Yellow
20-
Write-Host ""
15+
Write-Output "WARNING: Not running as Administrator."
16+
Write-Output "If symlink creation fails, either:"
17+
Write-Output " 1. Enable Developer Mode (Settings > Update & Security > For developers)"
18+
Write-Output " 2. Run PowerShell as Administrator"
19+
Write-Output ""
2120
}
2221

2322
# Remove existing directories/symlinks if they exist
@@ -34,21 +33,21 @@ try {
3433
New-Item -ItemType SymbolicLink -Path "Scripts" -Target "..\..\sample\Assets\Scripts" | Out-Null
3534
New-Item -ItemType SymbolicLink -Path "Scenes.meta" -Target "..\..\sample\Assets\Scenes.meta" | Out-Null
3635
New-Item -ItemType SymbolicLink -Path "Scripts.meta" -Target "..\..\sample\Assets\Scripts.meta" | Out-Null
37-
38-
Write-Host ""
39-
Write-Host "✅ Symlinks created successfully!" -ForegroundColor Green
40-
Write-Host ""
41-
Write-Host "Scenes and Scripts in sample-unity6 now point to sample/Assets" -ForegroundColor Green
36+
37+
Write-Output ""
38+
Write-Output "✅ Symlinks created successfully!"
39+
Write-Output ""
40+
Write-Output "Scenes and Scripts in sample-unity6 now point to sample/Assets"
4241
Get-ChildItem | Where-Object { $_.Name -match "Scenes|Scripts" } | Format-Table Name, LinkType, Target
4342
}
4443
catch {
45-
Write-Host ""
46-
Write-Host "❌ Failed to create symlinks!" -ForegroundColor Red
47-
Write-Host "Error: $_" -ForegroundColor Red
48-
Write-Host ""
49-
Write-Host "Please enable Developer Mode:" -ForegroundColor Yellow
50-
Write-Host " Settings > Update & Security > For developers > Developer Mode: ON" -ForegroundColor Yellow
51-
Write-Host "Then run this script again." -ForegroundColor Yellow
44+
Write-Output ""
45+
Write-Output "❌ Failed to create symlinks!"
46+
Write-Output "Error: $_"
47+
Write-Output ""
48+
Write-Output "Please enable Developer Mode:"
49+
Write-Output " Settings > Update & Security > For developers > Developer Mode: ON"
50+
Write-Output "Then run this script again."
5251
exit 1
5352
}
5453

setup-symlinks.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
#!/bin/bash
2+
# shellcheck shell=bash
33

44
# Setup script for creating symlinks between sample and sample-unity6
55
# Works on macOS and Linux
@@ -10,7 +10,7 @@ SAMPLE_UNITY6_ASSETS="$SCRIPT_DIR/sample-unity6/Assets"
1010
echo "Setting up symlinks for sample-unity6..."
1111

1212
# Remove existing directories/symlinks if they exist
13-
cd "$SAMPLE_UNITY6_ASSETS"
13+
cd "$SAMPLE_UNITY6_ASSETS" || exit
1414
rm -rf Scenes Scripts
1515
rm -f Scenes.meta Scripts.meta
1616

@@ -23,5 +23,9 @@ ln -s ../../sample/Assets/Scripts.meta Scripts.meta
2323
echo "✅ Symlinks created successfully!"
2424
echo ""
2525
echo "Scenes and Scripts in sample-unity6 now point to sample/Assets"
26-
ls -la "$SAMPLE_UNITY6_ASSETS" | grep -E "(Scenes|Scripts)"
26+
for item in Scenes Scripts; do
27+
if [ -e "$SAMPLE_UNITY6_ASSETS/$item" ]; then
28+
ls -la "$SAMPLE_UNITY6_ASSETS/$item"
29+
fi
30+
done
2731

0 commit comments

Comments
 (0)