Skip to content

Commit

Permalink
fix: fix OverrunGL::actualVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 committed Jan 8, 2025
1 parent 20647e4 commit fd5408d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/module.conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ extensions.configure<JavaPluginExtension>("java") {
}

tasks.named<Jar>("jar") {
val split = projVersion.split('.', limit = 3)
manifest.attributes(
"Specification-Title" to projName,
"Specification-Vendor" to "Overrun Organization",
"Specification-Version" to projVersion.split('.', limit = 2)[0],
"Specification-Version" to "${split[0]}.${split[1]}",
"Implementation-Title" to projName,
"Implementation-Vendor" to "Overrun Organization",
"Implementation-Version" to projVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private OverrunGL() {
*/
public static String actualVersion() {
try {
final URL url = ((URLClassLoader) OverrunGL.class.getClassLoader()).findResource("META-INF/MANIFEST.MF");
final URL url = OverrunGL.class.getResource("/META-INF/MANIFEST.MF");
if (url == null) {
return VERSION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
public final class RuntimeHelper {
private static final Path tmpdir = Path.of(System.getProperty("java.io.tmpdir"))
.resolve("overrungl" + System.getProperty("user.name"));
private static final StackWalker STACK_WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
private static final Linker LINKER = Linker.nativeLinker();

/**
Expand Down Expand Up @@ -72,7 +71,7 @@ public static String unknownToken(String description, int token) {
/**
* Loads a library from classpath or local.
*
* @param module the module name. e.x. {@code glfw}
* @param module the module name. e.g. {@code glfw}
* @param basename the basename of the library (without file extensions)
* @param version the version suffix
* @return the {@link SymbolLookup}
Expand Down Expand Up @@ -107,7 +106,7 @@ public static SymbolLookup load(String module, String basename, String version)
if (!Files.exists(libFile)) {
// Extract
final String fromPath = module + "/" + os.familyName() + "-" + Architecture.current() + "/" + path;
try (var is = STACK_WALKER.getCallerClass().getClassLoader().getResourceAsStream(fromPath)) {
try (var is = ClassLoader.getSystemResourceAsStream(fromPath)) {
Files.copy(Objects.requireNonNull(is, "File not found in classpath: " + fromPath), libFile);
} catch (Exception e) {
throw new IllegalStateException("Couldn't load file: " + libFile.toAbsolutePath().normalize() + " or " + localFile.toAbsolutePath().normalize() + "; try setting -Doverrungl.natives to a valid path", e);
Expand Down

0 comments on commit fd5408d

Please sign in to comment.