forked from The-Wineskin-Project/wineskin-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappdb
executable file
·53 lines (50 loc) · 1.68 KB
/
appdb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#
# Open appdb in browser
#
# Copyright (C) 2015-2016 Michael Müller
# Copyright (C) 2016 Sebastian Lackner
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
# Encode special characters in an URL
function _urlencode()
{
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case "$c" in
[a-zA-Z0-9.~_-]) printf "$c" ;;
" ") printf "+" ;;
*) printf '%s' "$c" | xxd -p -c1 |
while read c; do printf '%%%s' "$c"; done ;;
esac
done
}
# Use "xdg-open" instead of "open" on Linux
if command -v xdg-open >/dev/null 2>&1; then
function open()
{
xdg-open "$1"
}
fi
# Search AppDB for a specific program
if [ "$#" -lt 1 ]; then
open "https://appdb.winehq.org/index.php" &> /dev/null
else
query=$(_urlencode "$*")
args="sClass=application&sTitle=Browse%20Applications&iappFamily-appNameOp0=2&sappFamily-appNameData0=$query"
open "https://appdb.winehq.org/objectManager.php?$args" &> /dev/null
fi