Showing 1 changed files with 29 additions and 11 deletions
+29 -11
.fgfs/fgfs_function
... ...
@@ -187,23 +187,41 @@ function fgfs () {
187 187
                 fi
188 188
 
189 189
                 local airport_data="$scenes_dir/Airports/$candidate_airport[1]:u/$candidate_airport[2]:u/$candidate_airport[3]:u/${candidate_airport:u}"
190
-                if [[ -a "${airport_data}.threshold.xml" ]]; then
190
+                if ! test -r "${airport_data}.threshold.xml"; then
191
+                    echo "airport ${candidate_airport:u} not found !"
192
+                fi
193
+
194
+                if test -n "$candidate_parking" && test "$candidate_parking" = '?'; then
195
+                    if test -r "${airport_data}.groundnet.xml"; then
196
+                        echo "Parkings ${candidate_airport:u}:"
197
+                        sed -rn "/<parkingList/,/parkingList>/s/^.* name=\"([^\"]+).*$/\1/p" "${airport_data}.groundnet.xml"
198
+                    else
199
+                        echo "no information for parkings available on ${candidate_airport:u}"
200
+                    fi
201
+                    return
202
+                elif test -n "$candidate_runway" && test "$candidate_runway" = '?'; then
203
+                    if test -r "${airport_data}.threshold.xml"; then
204
+                        echo "Runways ${candidate_airport:u}:"
205
+                        sed -rn 's|^.*<rwy>(.+)</rwy>.*$|\1|p' "${airport_data}.threshold.xml"
206
+                    else
207
+                        echo "no information for runways available on ${candidate_airport:u}"
208
+                    fi
209
+                    return
210
+                fi
211
+
212
+                if test -r "${airport_data}.threshold.xml"; then
191 213
                     fgfs_args+=(--airport=$candidate_airport)
192 214
                     if [[ -a "${airport_data}.groundnet.xml" && -n "$candidate_parking" ]]; then
193
-                        if test $candidate_parking = '?'; then
194
-                          echo "Parkings ${candidate_airport:u}:"
195
-                          sed -rn "/<parkingList/,/parkingList>/s/^.* name=\"([^\"]+).*$/\1/p" ${airport_data}.groundnet.xml
196
-                          return
197
-                        elif sed -rn "/<parkingList/,/parkingList>/p" ${airport_data}.groundnet.xml | grep -q "name=\"${candidate_parking}\""; then
215
+                        if sed -rn "/<parkingList/,/parkingList>/p" "${airport_data}.groundnet.xml" | grep -q "name=\"${candidate_parking}\""; then
198 216
                             fgfs_args+=("--parkpos='$candidate_parking'")
217
+                        else
218
+                            echo "$candidate_parking isn't a valid parking position"
199 219
                         fi
200 220
                     elif test -n "$candidate_runway"; then
201
-                        if test $candidate_runway = '?'; then
202
-                            echo "Runways ${candidate_airport:u}:"
203
-                            sed -rn 's|^.*<rwy>(.+)</rwy>.*$|\1|p' ${airport_data}.threshold.xml
204
-                            return
205
-                        elif grep -q "<rwy>${candidate_runway}</rwy>" ${airport_data}.threshold.xml; then
221
+                        if grep -q "<rwy>${candidate_runway}</rwy>" "${airport_data}.threshold.xml"; then
206 222
                             fgfs_args+=("--runway=$candidate_runway")
223
+                        else
224
+                            echo "$candidate_runway isn't a valid runway"
207 225
                         fi
208 226
                     fi
209 227
                 fi