[squeak-dev] Copying the sources file
Andreas Raab
andreas.raab at gmx.de
Wed Mar 31 07:08:35 UTC 2010
Hi -
I was just trying to implement the code for condensing the changes to
the end of the sources file and ran into some 'interesting' issues. I
would expect this to work:
fullName := 'test1.sources'.
"Copy sources file; change file name accordingly"
FileStream forceNewFileNamed: fullName do:[:newFile|
sourcesFile := SourceFiles at: 1.
sourcesFile position: 0.
FileDirectory default copyFile: sourcesFile toFile: newFile.
newFile position = sourcesFile size ifFalse:[self error: 'File copy
failed'].
].
But it fails. Then I tried something else:
fullName := 'test2.sources'.
"Copy sources file; change file name accordingly"
FileStream forceNewFileNamed: fullName do:[:newFile|
sourcesFile := SourceFiles at: 1.
sourcesFile position: 0.
[sourcesFile atEnd] whileFalse:[newFile nextChunkPut: sourcesFile
nextChunk].
newFile position = sourcesFile size ifFalse:[self error: 'File copy
failed'].
].
That fails to. Then I tried:
fullName := 'test3.sources'.
"Copy sources file; change file name accordingly"
FileStream forceNewFileNamed: fullName do:[:newFile|
sourcesFile := SourceFiles at: 1.
sourcesFile position: 0.
[sourcesFile atEnd] whileFalse:[newFile nextChunkPutWithStyle:
sourcesFile nextChunkText].
newFile position = sourcesFile size ifFalse:[self error: 'File copy
failed'].
].
That fails as well. Help! What am I doing wrong? How does one copy the
sources file properly and why do the above methods not work?
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|