Skip to content

Commit

Permalink
See if we can get bleep working on powershell.
Browse files Browse the repository at this point in the history
Found some instructions in dirs-dev/directories-jvm#49 (comment)
  • Loading branch information
oyvindberg committed Apr 28, 2023
1 parent 56696bf commit 1e2fab9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,13 @@ jobs:
if: runner.os == 'Windows'

- name: Test binary after build 1 (windows)
shell: cmd
env:
CI: true
# todo: fix tests on windows
run: .\${{ matrix.file_name }} --dev compile --no-color jvm213
if: runner.os == 'Windows'

- name: Test binary after build 2 (windows)
shell: cmd
env:
CI: true
# todo: fix tests on windows
Expand Down
15 changes: 13 additions & 2 deletions bleep-core/src/scala/bleep/UserPaths.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package bleep

import coursier.cache.shaded.dirs.ProjectDirectories
import coursier.cache.shaded.dirs.{GetWinDirs, ProjectDirectories}
import coursier.jniutils.WindowsKnownFolders

import java.nio.file.Path
import java.util

case class UserPaths(cacheDir: Path, configDir: Path) {
val bspSocketDir = cacheDir / "socket"
Expand All @@ -12,8 +14,17 @@ case class UserPaths(cacheDir: Path, configDir: Path) {
}

object UserPaths {
class JniGetWinDirs extends GetWinDirs {
override def getWinDirs(guids: String*): Array[String] =
guids.map(guid => WindowsKnownFolders.knownFolderPath(s"{$guid}")).toArray
}

def fromAppDirs: UserPaths = {
val dirs = ProjectDirectories.from("build", null, "bleep")
val getWinDirs =
if (coursier.paths.Util.useJni()) new JniGetWinDirs
else GetWinDirs.powerShellBased

val dirs = ProjectDirectories.from("build", null, "bleep", getWinDirs)
val cacheDir = Path.of(dirs.cacheDir)
val configDir = Path.of(dirs.configDir)

Expand Down

0 comments on commit 1e2fab9

Please sign in to comment.