revert to using a cached list of aircraft -- scanning the Aircraft/
dirs is only fast enough with hot file-cache, but a bit too painful otherwise. Updating the aircraft.list is now easier, though: Just type $ fgfs --aircraft=?<TAB>
This commit is contained in:
parent
eba2fd014d
commit
6fa20b5903
1 changed files with 22 additions and 5 deletions
|
@ -9,12 +9,16 @@
|
||||||
# "$HOME/.fgfs/". The script doesn't offer all available airports
|
# "$HOME/.fgfs/". The script doesn't offer all available airports
|
||||||
# for the --airport option, but only those listed in a file
|
# for the --airport option, but only those listed in a file
|
||||||
# $FG_HOME/airport.list if available, or a short default list otherwise.
|
# $FG_HOME/airport.list if available, or a short default list otherwise.
|
||||||
|
#
|
||||||
|
# After installing new aircraft you have to rebuild the aircraft list
|
||||||
|
# by typing $ fgfs --aircraft=?<TAB>
|
||||||
|
|
||||||
__fgfs_root=${FG_ROOT:-/usr/local/share/FlightGear}
|
__fgfs_root=${FG_ROOT:-/usr/local/share/FlightGear}
|
||||||
__fgfs_home=${FG_HOME:-$HOME/.fgfs}
|
__fgfs_home=${FG_HOME:-$HOME/.fgfs}
|
||||||
[ -d "$__fgfs_home" ] || mkdir -p "$__fgfs_home"
|
[ -d "$__fgfs_home" ] || mkdir -p "$__fgfs_home"
|
||||||
|
|
||||||
|
|
||||||
|
__fgfs_ac_list="$__fgfs_home/aircraft.list"
|
||||||
__fgfs_apt_list="$__fgfs_home/airport.list"
|
__fgfs_apt_list="$__fgfs_home/airport.list"
|
||||||
|
|
||||||
__fgfs_options="
|
__fgfs_options="
|
||||||
|
@ -184,6 +188,18 @@ fi
|
||||||
shopt -s progcomp
|
shopt -s progcomp
|
||||||
|
|
||||||
|
|
||||||
|
__fgfs_write_ac_list() {
|
||||||
|
rm -f $__fgfs_ac_list
|
||||||
|
for i in $__fgfs_root/Aircraft/*/*-set.xml; do
|
||||||
|
i=${i%-set.xml}
|
||||||
|
echo ${i##*/} >>$__fgfs_ac_list
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[ -e $__fgfs_ac_list ] || __fgfs_write_ac_list
|
||||||
|
|
||||||
|
|
||||||
__fgfs_ai_scenario() {
|
__fgfs_ai_scenario() {
|
||||||
local i
|
local i
|
||||||
for i in $__fgfs_root/AI/*.xml; do
|
for i in $__fgfs_root/AI/*.xml; do
|
||||||
|
@ -194,11 +210,9 @@ __fgfs_ai_scenario() {
|
||||||
|
|
||||||
|
|
||||||
__fgfs_aircraft() {
|
__fgfs_aircraft() {
|
||||||
local i
|
while read i; do
|
||||||
for i in $__fgfs_root/Aircraft/*/*-set.xml; do
|
echo $i
|
||||||
i=${i%-set.xml}
|
done <$__fgfs_ac_list
|
||||||
echo ${i##*/}
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,6 +236,9 @@ __fgfs() {
|
||||||
--ai-scenario=*)
|
--ai-scenario=*)
|
||||||
alt=$(__fgfs_offer $(__fgfs_ai_scenario))
|
alt=$(__fgfs_offer $(__fgfs_ai_scenario))
|
||||||
;;
|
;;
|
||||||
|
--aircraft=\?)
|
||||||
|
__fgfs_write_ac_list
|
||||||
|
;;
|
||||||
--aircraft=*|--vehicle=*)
|
--aircraft=*|--vehicle=*)
|
||||||
alt=$(__fgfs_offer $(__fgfs_aircraft))
|
alt=$(__fgfs_offer $(__fgfs_aircraft))
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue