[BUG, preliminary FIX]
Joshua Gargus
gargus at ugrad.cs.ualberta.ca
Fri Jun 11 15:37:21 UTC 1999
Hello,
I'm about to describe a problem I encountered, and provide
a fix that works for me, although I'm not sure it is
completely general.
THE CONTEXT
Squeak 2.4c on linux-ppc
THE ITCH
Cannot open a BookMorph. For example, if the book is at
/home/josh/TestBook.bo, then trying to select this in a file
browser and opening it as a book fails. This is because the
page files (/home/josh/TestBook[1234...].sp) are looked for
in the directory 'home/josh/' (the leading '/' is dropped).
Further experimentation led me to discover that the URL
handling in Scamper was lacking as well;
'file:/home/josh/tmp.txt' would again drop the leading '/'
and try to find the file as a relative pathname.
THE SCRATCH
Changeset included below. My concern is that this will cause
problems on Windows, Mac, Acorn, etc.; I don't know the filename
conventions on these operating systems. Could someone more
knowledgable than I take a look at the cross-platform implications
of my changeset, and fix it if necessary?
Thanks,
Josh
'From Squeak 2.4b of April 23, 1999 on 10 June 1999 at 10:15:49 pm'!
!FileUrl methodsFor: 'access' stamp: 'jcg 6/10/1999 11:10'!
pathDirString
"Path to directory as url, using slash as delimiter"
^ String streamContents: [ :s | self putAbsoluteDelimiterIfNecessary: s.
1 to: self path size - 1 do: [ :ii |
s nextPutAll: (path at: ii); nextPut: $/
] ]! !
!FileUrl methodsFor: 'access' stamp: 'jcg 6/10/1999 11:10'!
pathForDirectory
"Path using local file system's delimiter. $\ or $:"
^ String streamContents: [ :s | self putAbsoluteDelimiterIfNecessary: s.
1 to: self path size - 1 do: [ :ii |
s nextPutAll: (path at: ii); nextPut: FileDirectory default pathNameDelimiter
] ]! !
!FileUrl methodsFor: 'access' stamp: 'jcg 6/10/1999 11:10'!
pathForFile
"Path using local file system's delimiter. $\ or $:"
| first |
^String streamContents: [ :s | self putAbsoluteDelimiterIfNecessary: s.
first _ true.
self path do: [ :p |
first ifFalse: [ s nextPut: FileDirectory default pathNameDelimiter ].
first _ false.
s nextPutAll: p ] ]! !
!FileUrl methodsFor: 'private-initialization' stamp: 'jcg 6/10/1999 11:08'!
putAbsoluteDelimiterIfNecessary: aStream
self isAbsolute ifTrue: [ aStream nextPut: FileDirectory default pathNameDelimiter ]
! !
More information about the Squeak-dev
mailing list
|