care for projects fileOut directory in binaryFileOut
authorClaus Gittinger <cg@exept.de>
Sun, 05 Jan 1997 15:51:02 +0100
changeset 2068 6d5711ab4a44
parent 2067 36226285e85e
child 2069 f6183117f922
care for projects fileOut directory in binaryFileOut
Class.st
--- a/Class.st	Sun Jan 05 14:45:30 1997 +0100
+++ b/Class.st	Sun Jan 05 15:51:02 1997 +0100
@@ -2369,13 +2369,16 @@
 !
 
 binaryFileOut
-    "create a file 'class.cls' consisting of all methods in myself
-     in a portable binary format. The methods source is saved by reference
+    "create a file 'class.cls' (in the current projects fileOut-directory),
+     consisting of all methods in myself in a portable binary format. 
+     The methods source is saved by reference
      to the classes sourceFile if there is any.
      That sourcefile needs to be present after reload in order to be
      browsable."
 
     self binaryFileOutWithSourceMode:#reference
+
+    "Modified: 5.1.1997 / 15:40:05 / cg"
 !
 
 binaryFileOutOn:aStream
@@ -2404,25 +2407,40 @@
 !
 
 binaryFileOutWithSourceMode:sourceMode
-    "create a file 'class.cls' consisting of all methods in myself
-     in a portable binary format. 
+    "create a file 'class.cls' (in the current projects fileOut-directory),
+     consisting of all methods in myself in a portable binary format. 
      The argument controls how sources are to be saved:
-	#keep - include the source
-	#reference - include a reference to the sourceFile
-	#discard - dont save sources.
+        #keep - include the source
+        #reference - include a reference to the sourceFile
+        #discard - dont save sources.
 
      With #reference, the sourceFile needs to be present after reload 
      in order to be browsable."
 
-    |baseName fileName aStream|
+    |baseName fileName aStream dirName|
 
     baseName := (Smalltalk fileNameForClass:self name).
     fileName := baseName , '.cls'.
+
+    Project notNil ifTrue:[
+        dirName := Project currentProjectDirectory
+    ] ifFalse:[
+        dirName := ''
+    ].
+    fileName := dirName , fileName.
+
     aStream := FileStream newFileNamed:fileName.
-
+    aStream isNil ifTrue:[
+        ^ FileOutErrorSignal 
+                raiseRequestWith:fileName
+                errorString:('cannot create file:', fileName)
+    ].
+        
     aStream binary.
     self binaryFileOutOn:aStream sourceMode:sourceMode.
     aStream close.
+
+    "Modified: 5.1.1997 / 15:39:30 / cg"
 !
 
 fileOut
@@ -4564,6 +4582,6 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.234 1997-01-04 20:09:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.235 1997-01-05 14:51:02 cg Exp $'
 ! !
 Class initialize!