summarylogtreecommitdiffstats
path: root/heidisql.sh
blob: 552008d2ebd39cbf3cac1c3d2e752d78d1870b99 (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
31
32
33
34
#!/bin/bash

progName="heidisql"
progRealPath="/usr/share/$progName"
if [ -n "$HEIDISQL_HOME" ]; then
    progHome="$HEIDISQL_HOME"
else
    progHome="$HOME/.$progName"
fi
progBin="$progName.exe"

# Create folder
mkdir -p "$progHome" >/dev/null 2>&1

# Create read-only symlinks
ln -s "$progRealPath/$progBin" "$progHome/$progBin" >/dev/null 2>&1
ln -s "$progRealPath/readme.txt" "$progHome/readme.txt" >/dev/null 2>&1
ln -s "$progRealPath/libmysql.dll" "$progHome/libmysql.dll" >/dev/null 2>&1

# Create a blank config file (otherwise HeidiSQL stores its settings in the Windows Registry)
if [ -n "$XDG_CONFIG_HOME" ]; then
    mkdir -p "$XDG_CONFIG_HOME/$progName" >/dev/null 2>&1
    touch "$XDG_CONFIG_HOME/$progName/portable_settings.txt"
    ln -s "$XDG_CONFIG_HOME/$progName/portable_settings.txt" "$progHome/portable_settings.txt" >/dev/null 2>&1
else
    touch "$progHome/portable_settings.txt"
fi

# If default wineprefix defined - run from it
if [ -n "$WINEPREFIX" ]; then
    WINEDEBUG=-all WINEPREFIX="$WINEPREFIX" WINEDLLOVERRIDES="d2d1=n" wine "$progHome/$progBin" "$@"
else
    WINEDEBUG=-all WINEDLLOVERRIDES="d2d1=n" wine "$progHome/$progBin" "$@"
fi