#FEATURE by gg
authorsr
Tue, 14 Apr 2020 13:44:25 +0200
changeset 9034 9f89b8c764f6
parent 9033 e120b6ec8514
child 9035 f07b260cf6b5
#FEATURE by gg class: WinWorkstation changed: #nativeFileDialogBinaryPath extend search for native file dialog binaries
WinWorkstation.st
--- a/WinWorkstation.st	Thu Apr 09 11:07:07 2020 +0200
+++ b/WinWorkstation.st	Tue Apr 14 13:44:25 2020 +0200
@@ -17159,35 +17159,46 @@
 
 nativeFileDialogBinaryPath
     "
-	Display nativeFileDialogBinaryPath
+        Display nativeFileDialogBinaryPath
     "
 
     |pointerSize baseName
-     packageId directory|
+     packageId directory
+     errorMessage binaryFilename|
 
     pointerSize := ExternalAddress pointerSize.
     pointerSize == 4 ifTrue:[
-	baseName := 'nativeFileDialog32.exe'.
+        baseName := 'nativeFileDialog32.exe'.
     ] ifFalse:[
-	pointerSize == 8 ifTrue:[
-	    baseName := 'nativeFileDialog64.exe'.
-	] ifFalse:[
-	    self notYetImplemented.
-	].
+        pointerSize == 8 ifTrue:[
+            baseName := 'nativeFileDialog64.exe'.
+        ] ifFalse:[
+            self notYetImplemented.
+        ].
     ].
 
     packageId := 'stx:support/win32/nativeFileDialog'.
     directory := Smalltalk packageDirectoryForPackageId:packageId.
     directory isNil ifTrue:[
-	NativeFileDialogInitializeError
-	    raiseErrorString:('Could not find package directory for package id "%1"'
-		bindWith:packageId).
-    ].
-
-    ^ (directory / baseName) pathName
+        errorMessage := 'Could not find package directory for package id "%1"'
+            bindWith:packageId.
+
+        Logger warning:errorMessage.
+
+        "try to find the binaries inside my application directory"
+        binaryFilename := OperatingSystem nameOfSTXExecutable asFilename directory / baseName.
+        binaryFilename exists ifFalse:[
+            NativeFileDialogInitializeError raiseErrorString:errorMessage.
+        ].
+    ] ifFalse:[
+        binaryFilename := directory / baseName. 
+    ].
+
+    ^ binaryFilename pathName
 
     "Created: / 08-11-2018 / 16:06:59 / sr"
     "Modified: / 27-11-2018 / 11:32:32 / sr"
+    "Modified: / 14-04-2020 / 13:43:21 / Stefan Reise"
 !
 
 nativeFileDialogWithTitle:dialogTitleArg