# HG changeset patch # User Claus Gittinger # Date 852475862 -3600 # Node ID 6d5711ab4a4413c4c72b35519834ffb2ca47bec1 # Parent 36226285e85ee8c9fa81eefc02ea74689360309a care for projects fileOut directory in binaryFileOut diff -r 36226285e85e -r 6d5711ab4a44 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!