Skip to content

Commit b499ada

Browse files
committed
Give option to force unity editor executable if can't detect version (for versions 2019 and lower)
1 parent 5f44caa commit b499ada

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

create_unity_package.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,20 @@ if(-Not (Test-Path -Path "$output_dir")) {
4343
& "$unity_path" -version | Tee-Object -Variable unity_version | Out-Null
4444

4545
if ($unity_version -match '^[0-9]{4}\.[0-9]*\.[0-9]*[f]?[0-9]*$') {
46-
Write-Host "Unity editor confirmed..."
46+
Write-Host "Unity editor confirmed."
4747
} else {
48-
Write-Host "Can't confirm Unity editor. Exiting."
49-
exit 1
48+
while (1) {
49+
$confirmation = Read-Host "Can't confirm Unity editor. Do you want to force $unity_path as an Unity editor executable? [y]es or [n]o"
50+
if ($confirmation -eq 'y' -or $confirmation -eq 'Y') {
51+
break;
52+
} elseif ( $confirmation -eq 'n' -or $confirmation -eq 'N' ) {
53+
exit 1;
54+
} else {
55+
Write-Host "Please answer [y]es or [n]o.";
56+
}
57+
}
5058
}
59+
Write-Host "Using ${unity_path} editor."
5160

5261
$tmp_project_path = Join-Path -Path "$temp_dir" -ChildPath "\ros2cs_unity_project\$unity_version"
5362

create_unity_package.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,21 @@ UNITY_VERSION=`$UNITY_PATH -version`
7171

7272
# Test if unity editor is valid
7373
if [[ $UNITY_VERSION =~ ^[0-9]{4}\.[0-9]*\.[0-9]*[f]?[0-9]*$ ]]; then
74-
echo "Unity editor confirmed..."
74+
echo "Unity editor confirmed."
7575
else
76-
echo "Can't confirm Unity editor. Exiting."
77-
exit 1
76+
while true; do
77+
read -p "Can't confirm Unity editor. Do you want to force \"$UNITY_PATH\" as an Unity editor executable? [y]es or [N]o: " yn
78+
yn=${yn:-"n"}
79+
case $yn in
80+
[Yy]* ) break;;
81+
[Nn]* ) exit 1;;
82+
* ) echo "Please answer [y]es or [n]o.";;
83+
esac
84+
done
7885
fi
7986

87+
echo "Using \"${UNITY_PATH}\" editor."
88+
8089
TMP_PROJECT_PATH=/tmp/ros2cs_unity_project/$UNITY_VERSION
8190
# Create temp project
8291
if [ -d "$TMP_PROJECT_PATH" ]; then

0 commit comments

Comments
 (0)