summarylogtreecommitdiffstats
path: root/kindleforpc.sh
diff options
context:
space:
mode:
authorayakael2017-02-07 16:19:02 -0500
committerayakael2017-02-07 16:19:02 -0500
commit1e8e8762fbd6b9f584932a289ab86b1e11ea9595 (patch)
tree05a31c0bedda85e9105b7761d4558ed94995f796 /kindleforpc.sh
downloadaur-1e8e8762fbd6b9f584932a289ab86b1e11ea9595.tar.gz
Initial commit
Diffstat (limited to 'kindleforpc.sh')
-rw-r--r--kindleforpc.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/kindleforpc.sh b/kindleforpc.sh
new file mode 100644
index 000000000000..83ae59e35972
--- /dev/null
+++ b/kindleforpc.sh
@@ -0,0 +1,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[@]}"