[Bug?!] FileDirectory>>fullNameFor: (was RE: [ENH] UnixFileDirectorytweak)

Tim Rowledge rowledge at interval.com
Fri Dec 17 21:11:43 UTC 1999


--33033989-857024317-945436303=:1275829876
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII


On Fri 17 Dec, Raab, Andreas wrote:
> Tim,

> Argh. You're right - I just checked it. We need to fix this (I don't
> remember having seen your fixes - can you post them again?!).
Try the attached fix; it is _not_ an elegant final answer, but it does seem to
solve the problem pro tem.

> Though it
> doesn't explain why you can't open a relative file on Unix ;-)
I think it does in the case of CrLfFileStream.

tim

-- 
Drugs may lead to nowhere, but at least it's the scenic route.
Tim Rowledge:  rowledge at interval.com (w)  +1 (650) 842-6110 (w)
 tim at sumeru.stanford.edu (h)  <http://sumeru.stanford.edu/tim>

--33033989-857024317-945436303=:1275829876
Content-Type: TEXT/Plain; NAME="FileStream-2.cs"
Content-Transfer-Encoding: QUOTED-PRINTABLE


'From Squeak 2.5 of August 6, 1999 on 13 August 1999 at 9:37:35 pm'!=0D=0D!=
StandardFileStream class methodsFor: 'file creation' stamp: 'TPR 8/13/1999 =
21:22'!=0DfileNamed: fileName=0D=09"Open a file with the given name for rea=
ding and writing. If the name has no directory part, then the file will be =
created in the default directory. If the file already exists, its prior con=
tents may be modified or replaced, but the file will not be truncated on cl=
ose."=0D=0D=09^ self new open: (self fullName: fileName) forWrite: true=0D!=
 !=0D=0D!StandardFileStream class methodsFor: 'file creation' stamp: 'TPR 8=
/13/1999 21:21'!=0DnewFileNamed: fileName=0D =09"Create a new file with the=
 given name, and answer a stream opened for writing on that file. If the fi=
le already exists, ask the user what to do."=0D=0D=09| dir localName choice=
 newName fullName |=0D=09fullName _ self fullName: fileName.=0D=09(self isA=
FileNamed: fullName)=0D=09=09ifFalse: [^ self new open: fullName forWrite: =
true].=0D=0D=09"file already exists:"=0D=09dir _ FileDirectory forFileName:=
 fullName.=0D=09localName _ FileDirectory localNameFor: fullName.=0D=09choi=
ce _ (PopUpMenu=0D=09=09labels:=0D'overwrite that file=0Dchoose another nam=
e=0Dcancel')=0D=09=09startUpWithCaption: localName, '=0Dalready exists.'.=
=0D=0D=09choice =3D 1 ifTrue: [=0D=09=09dir deleteFileNamed: localName=0D=
=09=09=09ifAbsent: [self error: 'Could not delete the old version of that f=
ile'].=0D=09=09^ self new open: fullName forWrite: true].=0D=0D=09choice =
=3D 2 ifTrue: [=0D=09=09newName _ FillInTheBlank request: 'Enter a new file=
 name' initialAnswer: fullName.=0D=09=09fullName _ self fullName: newName.=
=0D=09=09^ self newFileNamed: fullName].=0D=0D=09self error: 'Please close =
this to abort file opening'.=0D! !=0D=0D!StandardFileStream class methodsFo=
r: 'file creation' stamp: 'TPR 8/13/1999 21:26'!=0DoldFileNamed: fileName=
=0D=09"Open an existing file with the given name for reading and writing. I=
f the name has no directory part, then the file will be created in the defa=
ult directory. If the file already exists, its prior contents may be modifi=
ed or replaced, but the file will not be truncated on close."=0D=0D=09| sel=
ection fullName newName |=0D=09fullName _ self fullName: fileName.=0D=09(se=
lf isAFileNamed: fullName) ifTrue:=0D=09=09[^ self new open: fullName forWr=
ite: true].=0D=0D=09"File does not exist..."=0D=09selection _ (PopUpMenu la=
bels:=0D'create a new file=0Dchoose another name=0Dcancel')=0D=09=09=09star=
tUpWithCaption: (FileDirectory localNameFor: fullName) , '=0Ddoes not exist=
..'.=0D=09selection =3D 1 ifTrue:=0D=09=09[^ self new open: fullName forWrit=
e: true].=0D=09selection =3D 2 ifTrue:=0D=09=09[ newName _ FillInTheBlank r=
equest: 'Enter a new file name'=0D=09=09=09=09=09=09initialAnswer:  fullNam=
e.=0D=09=09^ self oldFileNamed:=0D=09=09=09(self fullName: newName)].=0D=09=
self halt! !=0D=0D!StandardFileStream class methodsFor: 'file creation' sta=
mp: 'TPR 8/13/1999 21:29'!=0DreadOnlyFileNamed: fileName=0D=09"Open an exis=
ting file with the given name for reading."=0D=0D=09| selection fullName ne=
wName |=0D=09fullName _ self fullName: fileName.=0D=09(self isAFileNamed: f=
ullName) ifTrue:=0D=09=09[^ self new open: fullName forWrite: false].=0D=0D=
=09"File does not exist..."=0D=09selection _ (PopUpMenu labels: 'choose ano=
ther name=0Dcancel')=0D=09=09=09startUpWithCaption: (FileDirectory localNam=
eFor: fullName) , '=0Ddoes not exist.'.=0D=09selection =3D 1 ifTrue:=0D=09=
=09[newName _ FillInTheBlank request: 'Enter a new file name'=0D=09=09=09=
=09=09=09initialAnswer: (FileDirectory localNameFor: fullName).=0D=09=09^ s=
elf readOnlyFileNamed:=0D=09=09=09(self fullName: newName)].=0D=09self halt=
! !=0D=0D=0D
--33033989-857024317-945436303=:1275829876--





More information about the Squeak-dev mailing list