summarylogtreecommitdiffstats
path: root/kindleforpc.sh
blob: 83ae59e3597250aed6416c7c59f955e5b4fa7457 (plain)
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
#! /bin/bash

progName="kindleforpc"
progRealPath="/usr/share/$progName"
progHome="$HOME/.config/$progName"
progBin="Kindle.exe"

# Symlink stuff
mkdir -p "$progHome" || exit 1
# Delete broken symlinks
find -L "$progHome" -type l -delete
# Update existing symlpiinks, add new symlinks
cp -urs "$progRealPath/"* "$progHome" 2> /dev/null

# Switches: use -something instead of /something to avoid confusion with Unix paths
# Also convert Unix paths to Windows paths.
declare -a args

for arg; do
    if [[ "${arg:0:1}" = "-" ]]; then
        args+=("${arg/#-//}")
    else
        args+=("$(winepath -w "$arg")")
    fi
done

wine "$progHome/$progBin" "${args[@]}"