mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gio: Always include mounts in the results
Mounts are currently completed only if the prefix looks like scheme, however, this doesn't work well if the mounts have also path component. Let's always include them to fix this issue. The mounts are cached by the volume monitors, so it should not significantly affect the performance.
This commit is contained in:
parent
8bc52105ef
commit
b3bf1e263e
@ -47,17 +47,15 @@ __gio_location() {
|
||||
dir=${cur%$(basename "$cur")}
|
||||
fi
|
||||
|
||||
# List mounts and volumes, just if dir is not specified, or looks like scheme
|
||||
local mounts=()
|
||||
if [[ $dir == "" ]] || [[ $dir =~ ":"$ && ! $dir =~ "/" ]]; then
|
||||
while IFS=$'\n' read mount; do
|
||||
# Do not care about local mounts
|
||||
[[ "$mount" =~ ^"file:" ]] && continue
|
||||
# List volumes and mounts
|
||||
local mounts=( )
|
||||
while IFS=$'\n' read mount; do
|
||||
# Do not care about local mounts
|
||||
[[ "$mount" =~ ^"file:" ]] && continue
|
||||
|
||||
# Use only matching mounts
|
||||
[[ "$mount" =~ ^"$cur" && "$mount" != "$cur" ]] && mounts+=("$mount")
|
||||
done < <(gio mount -li | sed -n -r 's/^ *(default_location|activation_root)=(.*)$/\2/p' | sort -u)
|
||||
fi
|
||||
# Use only matching mounts
|
||||
[[ "$mount" =~ ^"$cur" && "$mount" != "$cur" ]] && mounts+=("$mount")
|
||||
done < <(gio mount -li | sed -n -r 's/^ *(default_location|activation_root)=(.*)$/\2/p' | sort -u)
|
||||
|
||||
# Workaround to unescape dir name (e.g. "\ " -> " ")
|
||||
declare -a tmp="( ${dir} )"
|
||||
|
Loading…
Reference in New Issue
Block a user