Skip to content

Commit 3c2ad6b

Browse files
accomodate gamedir with space in name during cleanup
1 parent f1eb7db commit 3c2ad6b

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

scripts/quakecleanup

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,23 @@ fi
9595
# userdata_home/mod.
9696
if [[ -n "$shortcuts_dir" && -d "$shortcuts_dir" ]]
9797
then
98-
for file in $(ls -1 "$shortcuts_dir"/*.quake 2> /dev/null)
99-
do
100-
target=$(gamedir_for_shortcut "$file")
101-
if [[ "$target" == "$basedir"/"$mod" ]]
102-
then
103-
rm -f "$file"
104-
else
105-
if [[ -n "$userdata_home" && "$target" == "$userdata_home"/"$mod" ]]
98+
shortcuts=$(ls -1d "$shortcuts_dir"/*.quake 2> /dev/null)
99+
if [[ -n "$shortcuts" ]]
100+
then
101+
while IFS= read -r file
102+
do
103+
target=$(gamedir_for_shortcut "$file")
104+
if [[ "$target" == "$basedir"/"$mod" ]]
106105
then
107106
rm -f "$file"
107+
else
108+
if [[ -n "$userdata_home" && "$target" == "$userdata_home"/"$mod" ]]
109+
then
110+
rm -f "$file"
111+
fi
108112
fi
109-
fi
110-
done
113+
done <<< "$shortcuts"
114+
fi
111115
fi
112116

113117
# Delete the corresponding subdirectory of basedir, unless configured not to.

0 commit comments

Comments
 (0)