mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 15:00:54 +03:00
NativeLibrary: use System.mapLibraryName() instead of own implementation
This commit is contained in:
@@ -136,7 +136,7 @@ class FlatWindowsNativeWindowBorder
|
|||||||
|
|
||||||
String libraryPath = System.getProperty( FlatSystemProperties.NATIVE_LIBRARY_PATH );
|
String libraryPath = System.getProperty( FlatSystemProperties.NATIVE_LIBRARY_PATH );
|
||||||
if( libraryPath != null ) {
|
if( libraryPath != null ) {
|
||||||
File libraryFile = new File( libraryPath, libraryName + ".dll" );
|
File libraryFile = new File( libraryPath, System.mapLibraryName( libraryName ) );
|
||||||
if( libraryFile.exists() )
|
if( libraryFile.exists() )
|
||||||
return new NativeLibrary( libraryFile, true );
|
return new NativeLibrary( libraryFile, true );
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -143,16 +143,19 @@ public class NativeLibrary
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add prefix and suffix to library name.
|
||||||
|
* <ul>
|
||||||
|
* <li>Windows: libraryName + ".dll"
|
||||||
|
* <li>macOS: "lib" + libraryName + ".dylib"
|
||||||
|
* <li>Linux: "lib" + libraryName + ".so"
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
private static String decorateLibraryName( String libraryName ) {
|
private static String decorateLibraryName( String libraryName ) {
|
||||||
if( SystemInfo.isWindows )
|
|
||||||
return libraryName.concat( ".dll" );
|
|
||||||
|
|
||||||
String suffix = SystemInfo.isMacOS ? ".dylib" : ".so";
|
|
||||||
|
|
||||||
int sep = libraryName.lastIndexOf( '/' );
|
int sep = libraryName.lastIndexOf( '/' );
|
||||||
return (sep >= 0)
|
return (sep >= 0)
|
||||||
? libraryName.substring( 0, sep + 1 ) + "lib" + libraryName.substring( sep + 1 ) + suffix
|
? libraryName.substring( 0, sep + 1 ) + System.mapLibraryName( libraryName.substring( sep + 1 ) )
|
||||||
: "lib" + libraryName + suffix;
|
: System.mapLibraryName( libraryName );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void log( String msg, Throwable thrown ) {
|
private static void log( String msg, Throwable thrown ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user