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 17976e6
Show file tree
Hide file tree
Showing 3 changed files with 26 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
17 changes: 17 additions & 0 deletions bleep-core/src/java/bleep/internal/JniGetWinDirs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package bleep.internal;

import coursier.cache.shaded.dirs.GetWinDirs;
import coursier.jniutils.WindowsKnownFolders;

import java.util.ArrayList;

public class JniGetWinDirs implements GetWinDirs {
@Override
public String[] getWinDirs(String... guids) {
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < guids.length; i++) {
list.add(WindowsKnownFolders.knownFolderPath("{" + guids[i] + "}"));
}
return list.toArray(new String[list.size()]);
}
}
11 changes: 9 additions & 2 deletions bleep-core/src/scala/bleep/UserPaths.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package bleep

import coursier.cache.shaded.dirs.ProjectDirectories
import bleep.internal.JniGetWinDirs
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 @@ -13,7 +16,11 @@ case class UserPaths(cacheDir: Path, configDir: Path) {

object UserPaths {
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 17976e6

Please sign in to comment.