Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`-sbt-dir` option is not respected for the `preloaded` directory #3598

Closed
ayekat opened this Issue Oct 3, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@ayekat
Copy link

ayekat commented Oct 3, 2017

steps

  1. Run sbt -sbt-dir /path/to/some/directory
  2. Notice ~/.sbt being created

problem

The boot and staging directories are correctly created under /path/to/some/directory, but the preloaded directory ends up in ~/.sbt.

expectation

Running with -sbt-dir ..., I expect all files that would normally show up in ~/.sbt to be stored in the specified directory instead.

notes

sbt version: 1.0.2 on Arch Linux

@ayekat ayekat referenced this issue Oct 3, 2017

Open

Get rid of remaining dotfile clutter in ~/ #7

10 of 17 tasks complete

@dwijnand dwijnand added the Bug label Oct 4, 2017

@dwijnand

This comment has been minimized.

Copy link
Member

dwijnand commented Oct 4, 2017

-sbt-dir sets the system property sbt.global.base which isn't be honoured.

@ayekat

This comment has been minimized.

Copy link
Author

ayekat commented Jan 31, 2018

I will dare referencing #3681 here, as I actually only use -sbt-dir as a workaround for the non-compliance with the XDG base directory specification on Linux.

I have a wrapper script for sbt to set -sbt-dir "$XDG_DATA_HOME/sbt", to fight the clutter of "dotfiles" in my home directory—hence my slightly allergic reaction when I suddenly encountered ~/.sbt 😄.

@wrighton

This comment has been minimized.

Copy link

wrighton commented May 16, 2018

I think the problem is right here:

bin/sbt-launch-lib.bash

syncPreloaded() {
  if [[ "$init_sbt_version" == "" ]]; then
    # FIXME: better $init_sbt_version detection
    init_sbt_version="$(ls -1 "$sbt_home/lib/local-preloaded/org.scala-sbt/sbt/")"
  fi
  [[ -f "$HOME/.sbt/preloaded/org.scala-sbt/sbt/$init_sbt_version/jars/sbt.jar" ]] || {
    # lib/local-preloaded exists (This is optional)
    [[ -d "$sbt_home/lib/local-preloaded/" ]] && {
      command -v rsync >/dev/null 2>&1 && {
        mkdir -p "$HOME/.sbt/preloaded"
        rsync -a --ignore-existing "$sbt_home/lib/local-preloaded/" "$HOME/.sbt/preloaded"
      }
    }
  }
}

That is an odd bit of scripting there, IMO.

liff added a commit to liff/sbt-launcher-package that referenced this issue Oct 9, 2018

@eed3si9n eed3si9n added the ready label Oct 9, 2018

liff added a commit to liff/sbt-launcher-package that referenced this issue Oct 10, 2018

@eed3si9n eed3si9n removed the ready label Oct 10, 2018

liff added a commit to liff/sbt-launcher-package that referenced this issue Oct 17, 2018

@wrighton

This comment has been minimized.

Copy link

wrighton commented Dec 6, 2018

I found that this fix did not work for me, with bash 3 (which is the default where I work). Changing to Bash4 solved it. If this can be reproduced, maybe should do some sort of version check on bash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.