Oops, merged lost Smalltalk/X compatibility fixes
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 05 May 2015 15:07:56 +0200
changeset 450 914c2567c987
parent 449 c1b26806ee0b
child 451 989570319d14
Oops, merged lost Smalltalk/X compatibility fixes
compiler/benchmarks/PPCBenchmarkResources.st
--- a/compiler/benchmarks/PPCBenchmarkResources.st	Tue May 05 15:07:19 2015 +0200
+++ b/compiler/benchmarks/PPCBenchmarkResources.st	Tue May 05 15:07:56 2015 +0200
@@ -25,11 +25,11 @@
 	files := self readDirectory: directory.
 	files := self files: files withExtension: 'java'.
 	
-	^ files collect: [ :f | (FileStream fileNamed: f) contents ]
+	^ files collect: [ :f | (FileStream fileNamed: f) contents asString ]
 !
 
 javaLangMath
-	^ (FileStream fileNamed: '../java-src/java/lang/Math.java') contents
+	^ (FileStream fileNamed: '../java-src/java/lang/Math.java') contents asString
 !
 
 javaSourcesBig
@@ -42,7 +42,7 @@
 	files := self readDirectory: directory.
 	files := self files: files withExtension: 'st'.
 	
-	^ files collect: [ :f | (FileStream fileNamed: f) contents ]
+	^ files collect: [ :f | (FileStream fileNamed: f) contents asString ]
 !
 
 smalltalkObjectMethods
@@ -76,16 +76,36 @@
 !PPCBenchmarkResources methodsFor:'private utilities'!
 
 files: files withExtension: extension
-	^ files select: [ :f | f extension = extension ] 
+    ( (Smalltalk respondsTo: #isSmalltalkX) and:[ Smalltalk isSmalltalkX ] ) ifTrue:[ 
+        ^ files select: [ :f | f suffix = extension ] 
+    ] ifFalse:[ 
+        "Assuming Pharo..."    
+        ^ files select: [ :f | f extension = extension ] 
+    ]
+
+    "Modified: / 20-04-2015 / 10:58:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 readDirectory: directory
-	| file |
-	file := directory asFileReference.
-	file exists ifTrue: [ 
-		^ file allFiles
-	].
-	^ #()
+        | file |
+
+        ( (Smalltalk respondsTo: #isSmalltalkX) and:[ Smalltalk isSmalltalkX ] ) ifTrue:[ 
+            file := directory asFilename.
+            file exists ifFalse:[  
+                self error: 'Directory does not exist'.
+            ].
+            ^ file recursiveDirectoryContentsAsFilenames select:[:each | each isRegularFile ]
+        ] ifFalse:[ 
+            "Assuming Pharo..."
+
+            file := directory asFileReference.
+            file exists ifFalse: [ 
+                self error: 'Directory does not exist'.
+            ].
+            ^ file allFiles
+        ]
+
+    "Modified: / 20-04-2015 / 11:12:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !PPCBenchmarkResources class methodsFor:'documentation'!