ExternalLibraryFunction.st
changeset 24825 363db976dea9
parent 24451 0aa7d8be211f
child 24826 d73b54f3c744
--- a/ExternalLibraryFunction.st	Wed Oct 09 11:17:07 2019 +0200
+++ b/ExternalLibraryFunction.st	Wed Oct 09 17:32:36 2019 +0200
@@ -1266,18 +1266,18 @@
     |handle nameString filename dllPaths hasSuffix|
 
     ObjectFileLoader isNil ifTrue:[
-	"no libcomp loaded"
-	^ self primitiveFailed:'libcomp:ObjectFileLoader is not available'.
+        "no libcomp loaded"
+        ^ self primitiveFailed:'libcomp:ObjectFileLoader is not available'.
     ].
 
     (ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifFalse:[
-	ObjectFileLoader::ObjectFileLoadError raiseErrorString:('ObjectFileLoader cannot load dll/module: "%1"' bindWith:nameString)e.
-	^ nil.
+        ObjectFileLoader::ObjectFileLoadError raiseErrorString:('ObjectFileLoader cannot load dll/module: "%1"' bindWith:nameString).
+        ^ nil.
     ].
 
     filename := dllName.
     DllMapping notNil ifTrue:[
-	filename := DllMapping at:filename ifAbsent:[ filename ]
+        filename := DllMapping at:dllName ifAbsent:[ filename ]
     ].
 
     filename := filename asFilename.
@@ -1285,49 +1285,49 @@
     "try to load, maybe the system knows where to find the dll"
     handle := ObjectFileLoader loadDynamicObject:filename.
     handle notNil ifTrue:[
-	^ handle
+        ^ handle
     ].
 
     nameString := filename name.
     hasSuffix := filename suffix notEmpty.
 
     filename isAbsolute ifTrue:[
-	hasSuffix ifFalse:[
-	    "/ try again with the OS-specific dll-extension
-	    ObjectFileLoader sharedLibrarySuffixes do:[:eachPossibleSuffix |
-		handle := ObjectFileLoader loadDynamicObject:(filename withSuffix:eachPossibleSuffix).
-		handle notNil ifTrue:[
-		    ^ handle
-		].
-	    ].
-	].
+        hasSuffix ifFalse:[
+            "/ try again with the OS-specific dll-extension
+            ObjectFileLoader sharedLibrarySuffixes do:[:eachPossibleSuffix |
+                handle := ObjectFileLoader loadDynamicObject:(filename withSuffix:eachPossibleSuffix).
+                handle notNil ifTrue:[
+                    ^ handle
+                ].
+            ].
+        ].
     ] ifFalse:[
-	"First ask the class defining the ExternalFunction for the location of the dlls ..."
-	dllPaths := #().
-	owningClass notNil ifTrue:[
-	    dllPaths := owningClass dllPath.
-	].
-	".. then ask the system .. and the settings"
-	dllPaths := dllPaths, self class dllPath, UserPreferences current dllPath.
-
-	dllPaths do:[:eachDirectory |
-	    |libraryName|
-
-	    libraryName := eachDirectory asFilename construct:nameString.
-	    hasSuffix ifTrue:[
-		handle := ObjectFileLoader loadDynamicObject:libraryName.
-		handle notNil ifTrue:[
-		    ^ handle
-		].
-	    ] ifFalse:[
-		ObjectFileLoader sharedLibrarySuffixes do:[:eachPossibleSuffix |
-		    handle := ObjectFileLoader loadDynamicObject:(libraryName withSuffix:eachPossibleSuffix).
-		    handle notNil ifTrue:[
-			^ handle
-		    ].
-		].
-	    ].
-	].
+        "First ask the class defining the ExternalFunction for the location of the dlls ..."
+        dllPaths := #().
+        owningClass notNil ifTrue:[
+            dllPaths := owningClass dllPath.
+        ].
+        ".. then ask the system .. and the settings"
+        dllPaths := dllPaths, self class dllPath, UserPreferences current dllPath.
+
+        dllPaths do:[:eachDirectory |
+            |libraryName|
+
+            libraryName := eachDirectory asFilename construct:nameString.
+            hasSuffix ifTrue:[
+                handle := ObjectFileLoader loadDynamicObject:libraryName.
+                handle notNil ifTrue:[
+                    ^ handle
+                ].
+            ] ifFalse:[
+                ObjectFileLoader sharedLibrarySuffixes do:[:eachPossibleSuffix |
+                    handle := ObjectFileLoader loadDynamicObject:(libraryName withSuffix:eachPossibleSuffix).
+                    handle notNil ifTrue:[
+                        ^ handle
+                    ].
+                ].
+            ].
+        ].
     ].
 
 
@@ -1340,7 +1340,7 @@
     "/ eg: self class dllMapping at:'libtesseract' put:('/opt/local/lib/libtesseract.dylib').
     "/ see also the settings dialog for external libraries.
     ObjectFileLoader::ObjectFileLoadError
-	raiseErrorString:('Cannot find or load dll/module: "%1" (check dllPath settings)' bindWith:nameString).
+        raiseErrorString:('Cannot find or load dll/module: "%1" (check dllPath settings)' bindWith:nameString).
     ^ nil
 
     "Modified: / 13-02-2017 / 01:14:05 / cg"