Skip to content

Commit

Permalink
Hotfix: natives not loading
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 committed Sep 30, 2023
1 parent 4e9259f commit e74a40f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ enum class Artifact(

fun nativeFileName(platform: NativePlatform): String? {
return if (nativeBinding == null) null
else "$nativeBinding/${platform.osFamilyName}/${platform.osArch}/${platform.nativeLibPrefix}${nativeBinding.basename}${platform.nativeLibSuffix}"
else "${nativeBinding.bindingName}/${platform.osFamilyName}/${platform.osArch}/${platform.nativeLibPrefix}${nativeBinding.basename}${platform.nativeLibSuffix}"
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ public final class Exceptions {
*/
public static final StringTemplate.Processor<IllegalArgumentException, RuntimeException> IAE = stringTemplate ->
new IllegalArgumentException(stringTemplate.interpolate());

private Exceptions() {
//no instance
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,12 @@ public static SymbolLookup load(String module, String basename, String version)
var libFile = new File(file, STR. "\{ basename }-\{ version }\{ suffix }" );
if (!libFile.exists()) {
// Extract
try (var is = STACK_WALKER.getCallerClass().getClassLoader().getResourceAsStream(
STR. "\{ module }/\{ os.familyName() }/\{ Architecture.current() }/\{ path }"
)) {
Files.copy(Objects.requireNonNull(is), Path.of(libFile.getAbsolutePath()));
final String fromPath = STR. "\{ module }/\{ os.familyName() }/\{ Architecture.current() }/\{ path }" ;
try (var is = STACK_WALKER.getCallerClass().getClassLoader().getResourceAsStream(fromPath)) {
Files.copy(Objects.requireNonNull(is, STR. "File not found: \{ fromPath }" ),
Path.of(libFile.getAbsolutePath()));
} catch (Exception e) {
var exception = new IllegalStateException(STR. "File not found: \{ file }; try setting property -Doverrungl.natives to a valid path" );
exception.addSuppressed(e);
throw exception;
throw new IllegalStateException(STR. "File not found: \{ file }; try setting property -Doverrungl.natives to a valid path" , e);
}
}
uri = libFile.toURI();
Expand Down

0 comments on commit e74a40f

Please sign in to comment.