summarylogtreecommitdiffstats
path: root/melodfy
blob: c4a66802bd54485e0e69c7a771b382ba364fe1e0 (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
28
29
30
#!/bin/bash

progName="melodfy"
progRealPath="/usr/share/$progName"
progHome="$HOME/.$progName"
progBin="${progName^}.exe"
progPrefix="$HOME/.local/share/wineprefixes/$progName"

# Symlink stuff
mkdir -p "$progHome" || exit 1
mkdir -p "$HOME/.local/share/wineprefixes" || exit 1
# Delete broken symlinks
find -L "$progHome" -type l -delete
# Update existing symlinks, 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[@]}"
WINEARCH=win64 WINEPREFIX="$progPrefix" wine "$progHome/$progBin" "${args[@]}"