mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +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 );
|
||||
if( libraryPath != null ) {
|
||||
File libraryFile = new File( libraryPath, libraryName + ".dll" );
|
||||
File libraryFile = new File( libraryPath, System.mapLibraryName( libraryName ) );
|
||||
if( libraryFile.exists() )
|
||||
return new NativeLibrary( libraryFile, true );
|
||||
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 ) {
|
||||
if( SystemInfo.isWindows )
|
||||
return libraryName.concat( ".dll" );
|
||||
|
||||
String suffix = SystemInfo.isMacOS ? ".dylib" : ".so";
|
||||
|
||||
int sep = libraryName.lastIndexOf( '/' );
|
||||
return (sep >= 0)
|
||||
? libraryName.substring( 0, sep + 1 ) + "lib" + libraryName.substring( sep + 1 ) + suffix
|
||||
: "lib" + libraryName + suffix;
|
||||
? libraryName.substring( 0, sep + 1 ) + System.mapLibraryName( libraryName.substring( sep + 1 ) )
|
||||
: System.mapLibraryName( libraryName );
|
||||
}
|
||||
|
||||
private static void log( String msg, Throwable thrown ) {
|
||||
|
||||
Reference in New Issue
Block a user