File tree Expand file tree Collapse file tree
integration-tests/windows-api-tests
src/test/java/net/codecrete/windowsapi/tests
windowsapi-code-generator/src/main/java/net/codecrete/windowsapi/writer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 146146 <groupId >org.apache.maven.plugins</groupId >
147147 <artifactId >maven-surefire-plugin</artifactId >
148148 <version >${maven-surefire-plugin.version} </version >
149+ <configuration >
150+ <argLine >-Djava.library.path=C:/Users</argLine >
151+ </configuration >
149152 </plugin >
150153 </plugins >
151154 </pluginManagement >
Original file line number Diff line number Diff line change 1+ package net .codecrete .windowsapi .tests ;
2+
3+ import org .junit .jupiter .api .Test ;
4+
5+ import static org .assertj .core .api .Assertions .assertThat ;
6+
7+ class JavaLibraryPathTest {
8+ @ Test
9+ void javaLibraryPath_isOverridden () {
10+ assertThat (System .getProperty ("java.library.path" )).isEqualTo ("C:/Users" );
11+ }
12+ }
Original file line number Diff line number Diff line change @@ -60,15 +60,18 @@ public class Apis {
6060
6161 """ );
6262
63- writer .println (" static {" );
63+ writer .print ("""
64+ static {
65+ var libraryPath = System.getenv("WINDIR") + "\\ \\ SYSTEM32\\ \\ ";
66+ """ );
6467 functions .stream ().map (Method ::dll ).filter (Objects ::nonNull ).distinct ().sorted ().forEach (dll ->
6568 writer .printf ("""
66- System.loadLibrary( "%s");
67- """ , dllName (dll )));
69+ System.load(libraryPath + "%s.dll ");
70+ """ , dllName (dll )));
6871 writer .print ("""
69- }
70-
71- """ );
72+ }
73+
74+ """ );
7275
7376 boolean usesLastError = anyFunctionUsesLastError (functions );
7477
You can’t perform that action at this time.
0 commit comments