--- bin/sbt.orig	2020-10-05 00:22:37 UTC
+++ bin/sbt
@@ -80,7 +80,7 @@ cygwinpath() {
 
 
 declare -r sbt_bin_dir="$(dirname "$(realpathish "$0")")"
-declare -r sbt_home="$(dirname "$sbt_bin_dir")"
+declare -r sbt_home="$sbt_bin_dir"
 
 echoerr () {
   echo 1>&2 "$@"
@@ -93,7 +93,7 @@ dlog () {
 }
 
 jar_file () {
-  echo "$(cygwinpath "${sbt_home}/bin/sbt-launch.jar")"
+  echo "$(cygwinpath "${sbt_home}/sbt-launch.jar")"
 }
 
 acquire_sbt_jar () {
@@ -290,14 +290,14 @@ getPreloaded() {
 }
 
 syncPreloaded() {
-  local source_preloaded="$sbt_home/lib/local-preloaded/"
+  local source_preloaded="$sbt_home/local-preloaded/"
   local target_preloaded="$(getPreloaded)"
   if [[ "$init_sbt_version" == "" ]]; then
     # FIXME: better $init_sbt_version detection
     init_sbt_version="$(ls -1 "$source_preloaded/org/scala-sbt/sbt/")"
   fi
   [[ -f "$target_preloaded/org/scala-sbt/sbt/$init_sbt_version/" ]] || {
-    # lib/local-preloaded exists (This is optional)
+    # local-preloaded exists (This is optional)
     [[ -d "$source_preloaded" ]] && {
       command -v rsync >/dev/null 2>&1 && {
         mkdir -p "$target_preloaded"
@@ -406,8 +406,8 @@ run() {
 declare -ra noshare_opts=(-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy)
 declare -r sbt_opts_file=".sbtopts"
 declare -r build_props_file="$(pwd)/project/build.properties"
-declare -r etc_sbt_opts_file="/etc/sbt/sbtopts"
-# this allows /etc/sbt/sbtopts location to be changed
+declare -r etc_sbt_opts_file="%%PREFIX%%/etc/sbt/sbtopts"
+# this allows %%PREFIX%%/etc/sbt/sbtopts location to be changed
 declare -r etc_file="${SBT_ETC_FILE:-$etc_sbt_opts_file}"
 declare -r dist_sbt_opts_file="${sbt_home}/conf/sbtopts"
 declare -r win_sbt_opts_file="${sbt_home}/conf/sbtconfig.txt"
@@ -455,7 +455,7 @@ Usage: `basename "$0"` [options]
   SBT_OPTS            environment variable, if unset uses "$default_sbt_opts"
   .sbtopts            if this file exists in the current directory, its contents
                       are prepended to the runner args
-  /etc/sbt/sbtopts    if this file exists, it is prepended to the runner args
+  %%PREFIX%%/etc/sbt/sbtopts    if this file exists, it is prepended to the runner args
   -Dkey=val           pass -Dkey=val directly to the java runtime
   -J-X                pass option -X directly to the java runtime
                       (-J is stripped)
