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

Fix windows/powershell #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading